snap may execute host, not wrapped, executables

Bug #1681152 reported by John Hood
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.