Symlinks and /snap/bin structure?

@lucyllewy Indeed:

$ sudo ln -s /snap/bin/openfortivpn /bin/openfortivpn
$ 
$ /bin/openfortivpn --version
1.13.3
$ 
$ sudo ln -s /snap/bin/openfortivpn /bin/some_other_name
$ 
$ /bin/some_other_name --version
snap    2.44.2+20.04
snapd   2.44.2+20.04
series  16
ubuntu  20.04
kernel  5.4.0-21-generic
$ 

It makes sense of course now that you have told us, but this caveat should probably be documented in bold. Is there any way this could be avoided? Wouldn’t it be technically possible to have snap follow symlinks until the last one in /snap/bin and use that symlink to determine which command to run? If it is technically not possible to fix this caveat, it should documented in The snap format.

1 Like