bug-coreutils@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Antonio Diaz Diaz <antonio@gnu.org>
To: 61537@debbugs.gnu.org
Cc: Antonio Diaz Diaz <antonio@gnu.org>
Subject: bug#61537: [Bug-coreutils] 'cp -au' re-copies (removes and relinks) hard links that are up to date
Date: Wed, 15 Feb 2023 19:58:22 +0100	[thread overview]
Message-ID: <63ED2B4E.6070105@gnu.org> (raw)

Hello.

I have been forced recently to update my coreutils 8.11 (because 'touch' in 
8.11 didn't understand the dates with a 'T' separator passed to it by the 
configure of another GNU package I was installing) and have found that 'cp 
-au' now re-copies (removes and relinks) hard links that are up to date and 
it didn't recopy with 8.11.

I have tried coreutils 8.23 and 9.1, but I think all versions after 8.11 
have this problem.

To illustrate the problem, I first create a directory 'src' containing two 
linked files and then make a copy of 'src' in 'dest':

$ md src
$ echo "foo" > src/a
$ ln src/a src/b
$ cp -auv src dest
'src' -> 'dest'
'src/a' -> 'dest/a'
'src/b' -> 'dest/b'

Now, every time I update 'dest' using 'cp -au', it removes and relinks 
'dest/b' in spite of it already being a link to 'dest/a':

$ cp -auv src/* dest
removed 'dest/b'

But with 'cp' from coreutils 8.11, 'dest/b' was not recopied:

$ /tmp/coreutils-8.11/src/cp -auv src/* dest
$

Can current 'cp' be fixed so that it notices that the destination is already 
updated, and thus avoids removing and relinking it, just as it did in 
coreutils 8.11?

Thanks,
Antonio.




                 reply	other threads:[~2023-02-15 18:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63ED2B4E.6070105@gnu.org \
    --to=antonio@gnu.org \
    --cc=61537@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).