Skip to content

install_helper: make the mount.sshfs link without ln --relative - #412

Open
gowtham0992 wants to merge 2 commits into
libfuse:masterfrom
gowtham0992:portable-relative-link
Open

gowtham0992 wants to merge 2 commits into
libfuse:masterfrom
gowtham0992:portable-relative-link

Conversation

@gowtham0992

@gowtham0992 gowtham0992 commented Nov 29, 2026 •

Copy link
Copy Markdown

utils/install_helper.sh uses ln --relative, which is GNU coreutils only. With BusyBox's ln, meson install fails (BusyBox prints its usage and exits 1). I ran into it packaging SSHFS for QNX, whose self-hosted distribution uses BusyBox.

This computes the relative path in plain sh and passes it to a plain ln -s. I compared it with the current script under GNU coreutils' ln on Debian for six prefix/sbindir/bindir layouts: /usr sbin bin, /usr bin bin, /usr local/sbin local/bin, /opt/sshfs sbin bin, /usr /sbin bin and / sbin usr/bin. The links are identical in all six. With BusyBox's ln the current script fails and this one makes ../bin/sshfs. shellcheck is clean.

Update: the second commit makes the relative path match ln --relative in two more cases. It now creates the directories first and resolves them with cd -P and pwd -P, as GNU ln canonicalises them, so . and .. segments and a symlinked sbindir give the same link. Compared again under GNU coreutils for ten layouts: the six above, plus /usr ./sbin bin, /usr sbin/../sbin bin, /usr bin/../sbin ./bin, and /usr sbin bin with sbindir a symlink to another directory. The links are identical in all ten, and the script works with BusyBox's ln.

--relative is a GNU coreutils option. BusyBox's ln does not have it, so
"meson install" fails on systems that use BusyBox as their ln (QNX's
self-hosted distribution is one). Compute the relative path in plain sh
instead. For the six prefix/sbindir/bindir layouts tried, including the
default, sbindir equal to bindir and an absolute sbindir, the links are
the same as GNU ln --relative makes.
gowtham0992 added a commit to gowtham0992/qfuse that referenced this pull request Nov 29, 2026
Use cd -P and pwd -P on the two directories (both exist by then) before
working out the relative path, so "." and ".." in sbindir or bindir and a
symlinked sbindir give the same link as GNU ln --relative, and a relative
prefix cannot make the loop run forever. Checked against ln --relative on
Debian for ten layouts, including ./sbin, sbin/../sbin, bin/../sbin with
./bin, and sbin as a symlink to another directory; and with BusyBox's ln.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant