From 9a601eabebb82ad604a639c6c2c509d613a9bf3b Mon Sep 17 00:00:00 2001 From: Gowtham <15722259+gowtham0992@users.noreply.github.com> Date: Sat, 28 Nov 2026 20:50:58 -0700 Subject: [PATCH 1/2] install_helper: make the mount.sshfs link without ln --relative --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. --- utils/install_helper.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/utils/install_helper.sh b/utils/install_helper.sh index c62686c5..7294f0dc 100755 --- a/utils/install_helper.sh +++ b/utils/install_helper.sh @@ -10,10 +10,22 @@ bindir="$2" sbindir="$1" prefix="${MESON_INSTALL_DESTDIR_PREFIX}" +# Path of $2 relative to directory $1, both absolute. Plain sh, so it +# also works where ln has no --relative (BusyBox, BSD). +relative() { + from=$(printf '%s\n' "$1" | sed 's|//*|/|g; s|/$||') + to=$(printf '%s\n' "$2" | sed 's|//*|/|g') + common="$from" up="" + while [ "${to#"$common"/}" = "$to" ]; do + common="${common%/*}" + up="../$up" + done + printf '%s%s\n' "$up" "${to#"$common"/}" +} + mkdir -p "${prefix}/${sbindir}" -ln -svf --relative "${prefix}/${bindir}/sshfs" \ - "${prefix}/${sbindir}/mount.sshfs" +target=$(relative "${prefix}/${sbindir}" "${prefix}/${bindir}/sshfs") -ln -svf --relative "${prefix}/${bindir}/sshfs" \ - "${prefix}/${sbindir}/mount.fuse.sshfs" +ln -svf "${target}" "${prefix}/${sbindir}/mount.sshfs" +ln -svf "${target}" "${prefix}/${sbindir}/mount.fuse.sshfs" From 93c199979e045456d7067fbdea1688123673110d Mon Sep 17 00:00:00 2001 From: Gowtham <15722259+gowtham0992@users.noreply.github.com> Date: Sun, 29 Nov 2026 10:46:26 -0700 Subject: [PATCH 2/2] install_helper: resolve physical directories, as ln --relative does 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. --- utils/install_helper.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/install_helper.sh b/utils/install_helper.sh index 7294f0dc..30c19b6c 100755 --- a/utils/install_helper.sh +++ b/utils/install_helper.sh @@ -10,11 +10,14 @@ bindir="$2" sbindir="$1" prefix="${MESON_INSTALL_DESTDIR_PREFIX}" -# Path of $2 relative to directory $1, both absolute. Plain sh, so it -# also works where ln has no --relative (BusyBox, BSD). +mkdir -p "${prefix}/${sbindir}" "${prefix}/${bindir}" + +# Path of file $2 relative to directory $1, from their physical locations as +# GNU ln --relative uses, but in plain sh: BusyBox and BSD ln have no +# --relative. Both directories exist, so cd -P resolves ".", ".." and links. relative() { - from=$(printf '%s\n' "$1" | sed 's|//*|/|g; s|/$||') - to=$(printf '%s\n' "$2" | sed 's|//*|/|g') + from=$(cd -P -- "$1" && pwd -P) + to="$(cd -P -- "$(dirname -- "$2")" && pwd -P)/$(basename -- "$2")" common="$from" up="" while [ "${to#"$common"/}" = "$to" ]; do common="${common%/*}" @@ -23,8 +26,6 @@ relative() { printf '%s%s\n' "$up" "${to#"$common"/}" } -mkdir -p "${prefix}/${sbindir}" - target=$(relative "${prefix}/${sbindir}" "${prefix}/${bindir}/sshfs") ln -svf "${target}" "${prefix}/${sbindir}/mount.sshfs"