[Bug 2755] Copy (cp) command handles hard links incorrectly

bugzilla at busybox.net bugzilla at busybox.net
Sat Oct 30 01:59:26 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2755

--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com>  ---
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!

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list