← Back to issue list

classic snap are missing some env variables for reaching command name. (snap build, executing it fails)

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1670388
Type
issue
State
open
Author
~didrocks
Labels
amd64 apport-bug xenial
Created
Updated
Closed

Current evaluation

Classic-confinement snapcraft 2.27.1 app wrappers omit $SNAP/bin from PATH, so bare command names fail at runtime and shebangs resolve to system binaries instead of snap ones. Reported 2017, zero comments; later addressed in snapcraft via snapcraft-runner workaround (#2889).

Suggested action: close stale

Reason: Filed against snapcraft 2.27.1 on Ubuntu 16.04 in March 2017 with zero comments and no maintainer interaction for ~9.5 years. The underlying classic PATH problem was explicitly addressed later in the codebase: commit 343ac2862 'meta: always generate snapcraft-runner to workaround classic PATH bug (#2889)', and the old snapd workaround was removed for core20+ in #3087. The affected version is long unsupported and the behavior is superseded, so it is no longer applicable.

Impact: 45 Quick Win: 20.25 Staleness: 95 Complexity: 55 Confidence: 65 Support Request: 10

Issue body

1. Classic snap, where snapcraft.yaml can be found on lp:~didrocks/+junk/chuck-norris-webserver-classic. 2. Note that it declares and builds ok: apps:   node-service:     command: chuck-norris-app     daemon: simple     restart-condition: always   cli:     command: chuck-norris-cli 3. Building and installing, executing: $ chuck-norris-webserver-classic.cli /snap/chuck-norris-webserver-classic/x2/command-cli.wrapper: 2: exec: chuck-norris-cli: not found The issue is that indeed, the wrapper don't add $SNAP/bin/ to $PATH: #!/bin/sh exec "chuck-norris-cli" "$@" The non classic version works as it does add it to the path. Note that specifying "bin/chuck-norris-cli" instead of just "chuck-norris-cli" works in classic and generate something like: exec "$SNAP/bin/node" "$SNAP/bin/chuck-norris-cli" "$@" 4. Another side effect is that it's not the snap node version which is used in that case. The script declares "#!/usr/bin/env node" resolving to system one. #!/bin/sh exec "chuck-norris-cli" "$@" -> will resolve to the system one, while if specified as bin/chuck-norris-cli: exec "$SNAP/bin/node" "$SNAP/bin/chuck-norris-cli" "$@" I would expect in both case to prefer the snap version. ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: snapcraft 2.27.1 [modified: usr/lib/python3/dist-packages/snapcraft/_baseplugin.py usr/lib/python3/dist-packages/snapcraft/plugins/python.py] ProcVersionSignature: Ubuntu 4.4.0-64.85-generic 4.4.44 Uname: Linux 4.4.0-64-generic x86_64 NonfreeKernelModules: zfs zunicode zcommon znvpair zavl ApportVersion: 2.20.1-0ubuntu2.5 Architecture: amd64 CurrentDesktop: Unity Date: Mon Mar 6 16:06:59 2017 InstallationDate: Installed on 2012-05-28 (1743 days ago) InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425) PackageArchitecture: all SourcePackage: snapcraft UpgradeStatus: Upgraded to xenial on 2014-10-31 (857 days ago)

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 20.25
Staleness: 95
Complexity: 55
Confidence: 65
Support Request: 10
close stale Classic-confinement snapcraft 2.27.1 app wrappers omit $SNAP/bin from PATH, so bare command names fail at runtime and shebangs resolve to system binaries instead of snap ones. Reported 2017, zero comments; later addressed in snapcraft via snapcraft-runner workaround (#2889).
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 90
Support Request: 10
close stale Classic snap command wrapper fails to include $SNAP/bin in PATH, causing execution failures. Reported in 2017 for snapcraft 2.27.1 on Ubuntu 16.04; remains unaddressed and outdated.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 45
Confidence: 85
Support Request: 10
close stale Classic snaps fail to execute commands due to missing $SNAP/bin/ in wrapper PATH, causing execution errors and fallback to system binaries. Unaddressed since 2017.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 45
Confidence: 95
Support Request: 15
close stale Classic snap wrapper generation bug on Ubuntu 16.04 where $SNAP/bin/ is not added to PATH, causing command execution failures. Issue is over 9 years old and targets an EOL distribution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 40
Confidence: 90
Support Request: 5
close stale Classic snap wrapper scripts omit $SNAP/bin/ from PATH, causing command execution failures and forcing fallback to system binaries instead of snap versions. Reported against snapcraft 2.27.1 on Xenial. Open, unassigned, awaiting triage.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft/snapcraft#2889 (confidence 70%)

    Commit 343ac2862 'meta: always generate snapcraft-runner to workaround classic PATH bug (#2889)' directly targets the classic PATH bug described here.

  • Related To: snapcraft/snapcraft#3087 (confidence 55%)

    'meta: remove snapd workaround for classic for core20 onwards (#3087)' indicates the classic PATH workaround was superseded on newer bases.

  • Related To: snapcraft/snapcraft#4216 (confidence 45%)

    'meta: omit LD_LIBRARY_PATH and PATH in classic confinement (#4216)' shows continued deliberate handling of PATH in classic confinement.

Related issues

Issue Project State Summary Similarity
#1681861 classic snaps recurse snapcraft (launchpad) open Classic snap command wrappers generated by snapcraft use bare command names instead of $SNAP/bin/command paths, causing failures since PATH is not reset in classic confinement. 3429 days old, no labels, no comments, no maintainer interaction.
85%
#1681722 classic snaps cannot find stage packages in $PATH snapcraft (launchpad) open Classic snaps with stage-packages cannot find dependent binaries because snap bin directories are missing from default PATH. 9+ years old, zero comments, no labels. A related workaround (PR #2889, snapcraft-runner) was merged to address classic snap PATH resolution.
78%
#1681152 snap may execute host, not wrapped, executables snapcraft (launchpad) open Classic-confinement snap wrappers in /snap/bin may execute host executables instead of the snap's wrapped ones due to PATH resolution. Reported 2017, no maintainer interaction, no labels. Workaround (snapcraft-runner) merged in PR #2889.
78%
#1670749 classic confinement requires manually setting PATH and PYTHONPATH snapcraft (launchpad) open Classic-confinement snaps built with the python plugin require manually setting PATH and PYTHONPATH via environment: to include $SNAP/bin and $SNAP/lib/python2.7/site-packages; reporter argues snapcraft should do this automatically. No maintainer response or labels; issue is ~9 years old.
70%