Bug 8216 - cp -Ll doesn't dereference symlinks
Summary: cp -Ll doesn't dereference symlinks
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.23.x
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-10 16:52 UTC by Adam Sampson
Modified: 2015-07-10 16:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Sampson 2015-07-10 16:52:02 UTC
GNU cp and busybox cp behave differently if both -L (follow symlinks) and -l (create hardlinks) are specified, and you try to copy a symlink.

GNU cp (8.24) makes a hardlink to the file that's the target of the symlink.

busybox cp (1.23.2) makes a hardlink to the symlink itself.

Here's an example:

$ date >orig
$ ln -s orig symlink
$ cp -Ll symlink gnu-copy
$ busybox cp -Ll symlink busybox-copy
$ ls -li orig symlink gnu-copy busybox-copy
64454 lrwxrwxrwx 2 ats ats  4 Jul 10 17:48 busybox-copy -> orig
64453 -rw-r--r-- 2 ats ats 29 Jul 10 17:48 gnu-copy
64453 -rw-r--r-- 2 ats ats 29 Jul 10 17:48 orig
64454 lrwxrwxrwx 2 ats ats  4 Jul 10 17:48 symlink -> orig

-l isn't specified by POSIX, but the GNU cp behaviour is basically what I'd expect.