cp -pP (and e.g., -a): preserve time stamps on symlinks, too
commiteae535e1a322e244248bd31ed7e21ac95ecaa16d
authorJim Meyering <meyering@redhat.com>
Mon, 27 Jul 2009 15:08:02 +0000 (27 17:08 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 4 Aug 2009 15:38:54 +0000 (4 17:38 +0200)
treeecc8956558befd65ef146eb233d46e16dba7c735
parent1762092901adf040445d59931d14837ef7f2ebe1
cp -pP (and e.g., -a): preserve time stamps on symlinks, too

* src/copy.c (utimensat_if_possible): New function.
(copy_internal): Remove variable, "preserve_metadata".
Replace with "dest_is_symlink".  That covers all cases but one:
the one in which cp --link has created hard links to non-directories.
In that case, there is no need to update attributes of the links.
Use utimensat_if_possible, to preserve timestamps of symlinks.
* NEWS (New features): Mention this.
* tests/Makefile.am (TESTS): Add cp/preserve-slink-time.
* tests/cp/preserve-slink-time: New file.
* m4/jm-macros.m4 (coreutils_MACROS): Test for utimensat.
Reported in http://bugzilla.redhat.com/230866
NEWS
m4/jm-macros.m4
src/copy.c
tests/Makefile.am
tests/cp/preserve-slink-time [new file with mode: 0755]