Skip to content

Conversation

@pmenzel
Copy link
Contributor

@pmenzel pmenzel commented Sep 7, 2026

No description provided.

'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 <noreply@anthropic.com>
@pmenzel pmenzel merged commit 34fac6c into master Sep 7, 2026
Sign in to join this conversation on GitHub.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants