PATH set in snap-level environment is overriden by snap-confine
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Triaged
|
Undecided
|
Zygmunt Krynicki |
Bug Description
A snap with something like this in meta/snap.yaml
name: foo
version: 1
environment:
PATH: $PATH:/custom
apps:
foo:
command: foo
Will not see /custom in$ PATH because $PATH is reset by snap-confine, for startup of strict and devmode confinement snaps. To work around this you can set $PATH at the level of the application,
then snap-exec will apply it.
This makes me wonder if snap-confine should still set PATH to a fixed value. The value we set makes sense only for core and core-like base snaps, not all base snaps. Snap run has way more information about what ought to be set and in fact, is setting PATH when invoking snap-confine.
This bug is fixed in edge, where new snap environment handling has landed. I think the part about $PATH and snap-confine is true so I will file it nonetheless.
Do you have a solution in mind for the issue, or plans to work on it? I'll leave it assigned to you because you're familiar with the problem and this specific area, please reassign or unassign if you feel appropriate.