From 7324cff1c5a8638623e82418ce9df14bb37157ca Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Mon, 7 Sep 2026 15:24:42 +0200 Subject: [PATCH] install.sh: Never let install_symlink descend into its link name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'ln -sfv target link' treats 'link' as a directory to create the link *in* whenever it is a directory, or a symbolic link to one. install_symlink() therefore silently installs to the wrong place as soon as the link name is already occupied by a directory: $ mkdir -p a/icd.d $ ln -sfv /usr/share/mxgfx/vulkan/icd.d a/icd.d 'a/icd.d/icd.d' -> '/usr/share/mxgfx/vulkan/icd.d' That is the case for any /etc directory a tool created at runtime before mxtools started shipping it as a link, and the readlink() guard above does not catch it – readlink() of a directory is empty, so it always differs from the wanted target. '--no-dereference' is not enough, it only covers a symbolic link to a directory, not a real one. Use '--no-target-directory', which makes both cases behave: $ ln -sfTv /usr/share/mxgfx/vulkan/icd.d a/icd.d ln: a/icd.d: cannot overwrite directory Fail the install rather than continue, as the file is registered in the bee CONTENT either way, and a wrongly placed link would be recorded as if it had been installed. Assisted-by: Claude Opus 5 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 00b78e41..1ff39652 100755 --- a/install.sh +++ b/install.sh @@ -98,7 +98,7 @@ function install_symlink() if [ "$(readlink "$2")" != "$1" ]; then dir="$(dirname "$2")" test -d "$dir" || mkdir -p "$dir" - ln -sfv "$1" "$2" + ln -sfTv "$1" "$2" || exit 1 fi register_installed_file "$2" }