Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 2014 23:46:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 191974] New: |ln -sF| never calls rmdir(2) on target_file == target_dir, only target_dir/basename
Message-ID:  <bug-191974-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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@FreeBSD.org
          Reporter: jbeich@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-191974-8>