[Bug 191974] New: |ln -sF| never calls rmdir(2) on target_file == target_dir, only target_dir/basename

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jul 19 23:46:36 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191974

            Bug ID: 191974
           Summary: |ln -sF| never calls rmdir(2) on target_file ==
                    target_dir, only target_dir/basename
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: jbeich at vfemail.net
            Blocks: 92149

According to the manpage -F option is supposed to make ln(1) remove
target_file which happens to be a directory. What actually happens is
target_file converted to target_dir/basename and always fails when tested
with S_ISDIR().

It's also unclear why -s flag is required. If the source_file is not
a directory ln(1) can just call rmdir(2) + link(2) instead of rmdir(2) +
symlink(2).

$ echo >foo
$ mkdir bar
$ ln -sF foo bar
$ ls bar
foo

but replacing children works fine

$ echo >foo
$ mkdir -p bar/foo
$ ln -sF foo bar
$ stat -x bar/foo | head -2
  File: "bar/foo"
  Size: 3            FileType: Symbolic Link

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list