Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ln: last argument can be LINK_NAME when -n and -f are used together #6350

Open
BenWiederhake opened this issue May 4, 2024 · 1 comment
Open
Labels

Comments

@BenWiederhake
Copy link
Collaborator

BenWiederhake commented May 4, 2024

ln can be used to overwrite a link like so: ln -sfn target link_name, because:

ln [OPTION]... [-T] TARGET LINK_NAME

Here's a minimal reproducer:

$ mkdir a b; ln -s a mylink # setup
$ readlink mylink # verify setup
a
$ ../../../gnu/src/ln -sfn b mylink # demonstrate that GNU works
$ readlink mylink # verify success
b
$ rm mylink; ln -s a mylink; readlink mylink # reset and verify
a
$ cargo run -q ln -sfn b mylink
ln: Could not update 'mylink': Not a directory (os error 20)
$ echo $? # fails according to stderr, but actually works
0
$ readlink mylink # also, it did the right thing
b

Originally reported by @LuNeder. Apparently this affects NixOS adversely.

Similar to, but different from #5974. In particular, #5975 does NOT fix this issue (I tested it).

@LuNeder
Copy link

LuNeder commented May 4, 2024

Apparently this affects NixOS adversely.

Indeed it does, haha!

Thanks for your help earlier btw :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants