Subject: Re: bug#9277: cp
From: Eric Blake <[email-masked]>
To: vesselin kavalov <[email-masked]>
Cc: [email-masked]
Date: Wed, 10 Aug 2011 13:09:52 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

On 08/10/2011 12:40 PM, vesselin kavalov wrote:
> cp -a src/{a,b,c} dest does NOT preserve the time stamp on symbolic links.

Thanks for the report, but you are missing some details.  What version 
of coreutils?  What operating system?  And assuming Linux, what kernel 
version?

Be aware that symlink timestamp preservation requires the use of 
futimens or utimensat, which were only recently standardized by POSIX 
2008, and which are lacking on a lot of older systems; plus, being new 
interfaces, they require newer coreutils that actually takes advantage 
of the newer interfaces.  Also be aware that symlink timestamps are 
worthless - there's generally not much you can usefully do with them, 
whether or not you have the flexibility of modifying them.

At any rate, things work for me, using kernel 2.6.35 and coreutils 8.5 
(the defaults of Fedora 14):

$ ln -s a b
$ sleep 20
$ cp -a b c
$ stat b c
   File: `b' -> `a'
   Size: 1         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd02h/64770d	Inode: 266785      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (14986/  eblake)   Gid: (14986/  eblake)
Access: 2011-08-10 13:04:42.420640012 -0600
Modify: 2011-08-10 13:04:34.308611690 -0600
Change: 2011-08-10 13:04:34.308611690 -0600
   File: `c' -> `a'
   Size: 1         	Blocks: 0          IO Block: 4096   symbolic link
Device: fd02h/64770d	Inode: 304795      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (14986/  eblake)   Gid: (14986/  eblake)
Access: 2011-08-10 13:04:59.771700484 -0600
Modify: 2011-08-10 13:04:34.308611690 -0600
Change: 2011-08-10 13:04:57.174691438 -0600

Note that atime and mtime were indeed preserved.  Therefore, I'm closing 
this bug unless you can provide more details about any bugs still remaining.

>
> I understand that neither does 'tar' , but that probably is a fault, not a
> feature there either.

Wrong again.  The latest tar, coupled with the latest kernel, does 
support symlink timestamps.

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org