GNU bug report logs - #20775
cp: improve hardlink dups handling with "cp -a -u"

Previous Next

Package: coreutils;

Reported by: Steffen Zahn <steffzahn <at> gmail.com>

Date: Tue, 9 Jun 2015 04:35:03 UTC

Severity: wishlist

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steffen Zahn <steffzahn <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: cp -a -u destroys files after they are copied
Date: Tue, 09 Jun 2015 04:18:34 +0000
[Message part 1 (text/plain, inline)]
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 <at> gandalf:~ $ cd /tmp
sz <at> gandalf:/tmp $ mkdir 1 2 3
sz <at> gandalf:/tmp $ touch 1/a
sz <at> gandalf:/tmp $ ln 1/a 2/
sz <at> 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 <at> 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 <at> 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 <at> 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 <at> 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
[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.