Skip to content

ln: last argument not treated as a directory when -n and -f are used together #5974

@jansheikkinen

Description

@jansheikkinen

Using uutils, running

$ touch a b
$ mkdir c
$ ln -snf a b c/

results in an error that says

ln: Already exists
ln: will not overwrite just-created 'c/' with 'b'

whereas, using GNU coreutils, the result is that the symlinks c/a and c/b are created successfully. However, if you run it when c doesn't exist, or when it is a file, both give an error saying ln is not a directory. If you use -n without -f, or vice versa, the symlinks are created with no problems using both versions.

I'm not entirely sure what's going on here. When c/ is a directory, its appears to want it to be a non-existing destination file to link to, whereas when c either doesn't exist or is a file, it wants it to be a directory to put the link into.

Furthermore, when c/ is a directory, the first one fails with a simple error saying the destination already exists, but the second one fails with an error that suggests it thinks linking a to c actually worked, and it just doesn't want to overwrite the same file twice.

uutils: 0.0.24
GNU: 9.4
Platform: Gentoo Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions