snap may execute host, not wrapped, executables
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:/
cd mosh
snapcraft
sudo snap install mosh_master_
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/
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.