Hello,

I found that the cp command acts "sub-optimal" when copying hard-linked
files of the same name from several directories to one target directory, it
first copies the files then removes them. I cannot see how that can be the
intended behaviour. Please fix this.

best regards
     Steffen Zahn

sz@gandalf:~ $ cd /tmp
sz@gandalf:/tmp $ mkdir 1 2 3
sz@gandalf:/tmp $ touch 1/a
sz@gandalf:/tmp $ ln 1/a 2/
sz@gandalf:/tmp $ ls -li 1 2
1:
total 0
262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a

2:
total 0
262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
sz@gandalf:/tmp $ cp -a -u --verbose 1/* 2/* 3/
'1/a' -> '3/a'
removed '3/a'
cp: cannot create hard link '3/a' to '3/a': No such file or directory
sz@gandalf:/tmp $ cp --version
cp (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
sz@gandalf:/tmp $ ls -la 3/
total 8
drwxr-xr-x  2 sz   sz   4096 Jun  9 06:11 .
drwxrwxrwt 13 root root 4096 Jun  9 06:11 ..
sz@gandalf:/tmp $ uname -a
Linux gandalf 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux

Reply via email to