← Back to issue list

snap may execute host, not wrapped, executables

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1681152
Type
issue
State
open
Author
~cgull
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action: close stale

Reason: The issue is 9+ years old with zero maintainer interaction or labels. The underlying classic-snap PATH resolution bug has been worked around by PR #2889 (commit 343ac2862: 'meta: always generate snapcraft-runner to workaround classic PATH bug'), which prepends $SNAP/bin to PATH via a command-chain. The specific snapd version that exhibited this behavior is long out of support.

Impact: 30 Quick Win: 16.5 Staleness: 95 Complexity: 45 Confidence: 72 Support Request: 10

Issue body

In working on mosh for Snapcraft, I discovered that when you invoke wrapped executables in /snap/bin, the host's executable may be run instead. I suspect this is a classic-only bug. Repro: apt install mosh # this will install a release version of mosh, such as mosh-1.3.0 git clone -b snapcraft https://github.com/elopio/mosh cd mosh snapcraft sudo snap install mosh_master_amd64.snap --classic --dangerous # this installs a devel version such as mosh-1.3.0-11-g42a7a0c-dirty sudo snap alias mosh mosh sudo snap alias mosh mosh-client sudo snap alias mosh mosh-server /snap/bin/mosh --version # perl script reports mosh-1.3.0 /snap/bin/mosh-client --version # executable reports mosh-1.3.0 It appears that snap is not using an absolute path to run the wrapped executable. This is related to Bug #1670388 and Bug #1670749 but I think it's a distinct issue. One workaround is to set environment.PATH in snapcraft.yaml to $SNAP/bin:$PATH, but I do expect a wrapper to execute the correct executable, and setting PATH may cause problems.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 30
Quick Win: 16.5
Staleness: 95
Complexity: 45
Confidence: 72
Support Request: 10
close stale 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.
qwen/qwen3.6-35b-a3b
Staleness: 100
Complexity: 30
Confidence: 90
Support Request: 0
close stale Bug report stating snap wrappers in /snap/bin may execute host executables instead of snap-wrapped ones. Unlabeled, no maintainer interaction, inactive for over 9 years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 45
Confidence: 85
Support Request: 5
close stale Bug where snap wrapper scripts in /snap/bin execute host binaries instead of snap-wrapped ones. Untriaged, inactive for over 9 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 40
Confidence: 90
Support Request: 5
close stale Reports a bug where snap-wrapped executables in /snap/bin run the host version instead of the snap's. Unlabeled, unassigned, and has had zero maintainer interaction for over 9 years.
qwen3.6-35b-moe-q4
Staleness: 98
Complexity: 45
Confidence: 85
Support Request: 10
needs triage Reports a bug where snap aliases execute host binaries instead of wrapped snap binaries in classic mode. Untriaged, no maintainer response, over 9 years old.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#1670388 (confidence 80%)

    Referenced in the issue body as a related bug about classic snaps missing env variables for command name resolution.

  • Related To: snapcraft#1670749 (confidence 80%)

    Referenced in the issue body as a related bug about classic confinement requiring manual PATH/PYTHONPATH setup.

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

    PR #2889 merged a snapcraft-runner command-chain that prepends $SNAP/bin to PATH, directly addressing the classic-snap PATH resolution problem described in this issue. Commit message explicitly references 'classic PATH bug'.

Related issues

Issue Project State Summary Similarity
#1670388 classic snap are missing some env variables for reaching command name. (snap build, executing it fails) snapcraft (launchpad) open 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).
78%