| Summary: | Copy (cp) command handles hard links incorrectly | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Nigel Hathaway <nhathaway> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | NEW --- | ||
| Severity: | major | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.14.x | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Host: | Target: | ||
| Build: | |||
|
Description
Nigel Hathaway
2010-10-29 12:57:13 UTC
Reproduced with GNU coreutils 8.4 Gosh... it seems "follow symlinks" and "follow hardlinks" are handled asymmetrically by it. Thy this: #!/bin/sh rm -rf dir1 dir2 dir3 mkdir dir1 echo "Hello" >dir1/file1 ln dir1/file1 dir1/file2 ln -s file1 dir1/file3 ls -li dir1/* cp -r dir1 dir2 ls -li dir2/* cp -a dir1 dir3 ls -li dir3/* I am getting: 262180 -rw-r--r-- 2 root root 6 Oct 30 03:46 dir1/file1 262180 -rw-r--r-- 2 root root 6 Oct 30 03:46 dir1/file2 262183 lrwxrwxrwx 1 root root 5 Oct 30 03:46 dir1/file3 -> file1 262239 -rw-r--r-- 1 root root 6 Oct 30 03:46 dir2/file1 262238 -rw-r--r-- 1 root root 6 Oct 30 03:46 dir2/file2 262217 lrwxrwxrwx 1 root root 5 Oct 30 03:46 dir2/file3 -> file1 262250 -rw-r--r-- 2 root root 6 Oct 30 03:46 dir3/file1 262250 -rw-r--r-- 2 root root 6 Oct 30 03:46 dir3/file2 262246 lrwxrwxrwx 1 root root 5 Oct 30 03:46 dir3/file3 -> file1 cp -r preserves symlinks, but not hardlinks! The POSIX standard on this is here: http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html The standard itself is silent on hard links as far as its prescriptions are concerned, but in the Rationale section it says that cp does NOT maintain the hard-link structure of the source, contrasting this with the operation of pax. I am not arguing with you. I agree that this needs to be made compatible with coreutils... |