[Bug 229208] `install -l rs` (relative symlink to source) into directory creates invalid symlink

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jun 21 14:21:46 UTC 2018


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

            Bug ID: 229208
           Summary: `install -l rs` (relative symlink to source) into
                    directory creates invalid symlink
           Product: Base System
           Version: 11.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: andreas.sommer87 at googlemail.com

Created attachment 194459
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=194459&action=edit
Unit test which depicts expected behavior but currently fails

Good on 10.3-RELEASE:

$ rm -rf /tmp/dest && mkdir /tmp/dest && touch /tmp/myfile && cd /tmp &&
install -l rs ./myfile /tmp/dest && ls -la /tmp/dest
total 146
drwxr-xr-x   2 rmg-builder  wheel    3 Jun 21 14:12 .
drwxrwxrwt  16 root         wheel  613 Jun 21 14:12 ..
lrwxr-xr-x   1 rmg-builder  wheel    9 Jun 21 14:12 myfile -> ../myfile

Bad on 11.1-RELEASE and 11.2-rc3:

$ rm -rf /tmp/dest && mkdir /tmp/dest && touch /tmp/myfile && cd /tmp &&
install -l rs ./myfile /tmp/dest && ls -la /tmp/dest
total 8
drwxr-xr-x  2 vagrant  wheel  512 Jun 21 13:01 .
drwxrwxrwt  7 root     wheel  512 Jun 21 13:01 ..
lrwxr-xr-x  1 vagrant  wheel    8 Jun 21 13:01 myfile -> ./myfile

It seems that unit tests were only added to the source code after 10.4, and I
don't even know how the tool should behave. My expectation would be the
previous behavior, obviously, also because `install src
dest_which_is_a_directory` would normally be expected to create
`dest_which_is_a_directory/basename_of_src`.

Please find attached a new unit test to check for the old behavior. Did not dig
too deep into the code (usr.bin/xinstall/xinstall.c) yet to find a solution. My
feeling is that the function `makelink(...)` isn't even called in the buggy
case but probably should. Sharing it so more people can take a look.

I stumbled upon this because the ports tree macro `RLN` (see bsd.commands.mk)
is doing exactly this, and broke our software build on 11.x for internal ports.

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


More information about the freebsd-bugs mailing list