PATH auto extended with stage paths
Bug #2012504 reported by
Ondrej Kubik
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
snapcraft automatically adds <stage>/usr/bin and <stage>/usr/sbin, additionally those paths are added to the beginning.
This would usually work for native builds, but causes problems when running cross builds
e.g. including python in the snap, would make the next part fail, if it tries to use python from the stage directory, which is of the wrong architecture.
As a minimum, this should be avoided if cross-build is detected.
It is still questionable if this should be the default behaviour rather than in control of the snapcraft.yaml
e.g. staging JRE in the snap, vs using JDK from the build environment.
To post a comment you must log in.
Hey Ondrej,
The current behavior for PATH in a core22 snapcraft.yaml is:
- LD_LIBRARY_PATH or PATH are defined, keep user-defined values.
- LD_LIBRARY_PATH or PATH are not defined, set to default values.
- LD_LIBRARY_PATH or PATH are null, do not use default values.
As you mentioned, the default PATH is `$SNAP/ usr/sbin: $SNAP/usr/ bin:$SNAP/ sbin:$SNAP/ bin:$PATH` .
(source: https:/ /github. com/snapcore/ snapcraft/ blob/71ed1a3698 575d9b6a102a3b7 0dc497ecf88dca3 /snapcraft/ meta/snap_ yaml.py# L443)
If I understand correctly, are you suggesting that when cross-building, snapcraft should not automatically use the default PATH above?