[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#8374: cp -a [-l] sometimes does not preserve timestamps of symli
Re: bug#8374: cp -a [-l] sometimes does not preserve timestamps of symlinks
Thu, 31 Mar 2011 08:20:16 -0600
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:22.214.171.124) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9
On 03/31/2011 08:11 AM, Pádraig Brady wrote:
>> So probably -al is broken since you fixed -a in 7.5.
> Hmm it looks now like we're creating symlinks (with wrong timestamps),
> but in fact we should be creating hardlinks to symlinks.
> This seems to have been changed with:
> Eric do you have any suggestions?
> The following seems to make things work as expected
> diff --git a/src/copy.c b/src/copy.c
> index a672fd3..4f07d2c 100644
> --- a/src/copy.c
> +++ b/src/copy.c
> @@ -2226,8 +2226,7 @@ copy_internal (char const *src_name, char const
> where link(2) follows the link, gnulib creates a symlink with
> identical contents, which is good enough for our purposes). */
> else if (x->hard_link
> - && (!S_ISLNK (src_mode)
> - || x->dereference != DEREF_NEVER))
> + && !(S_ISLNK (src_mode) && x->dereference != DEREF_NEVER))
> if (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, 0))
> Hmm, maybe it's better to skip linkat() for symlinks altogether
> since the gnulib fallback on systems that implicitly dereference,
> will create symlinks, but without the right timestamps.
> Or, perhaps the gnulib fallback should try to update timestamps too?
Sounds to me like the gnulib fallback should be made smarter. Which
systems lack linkat() but have the capability to set timestamps? BSD?
But the original report was about opensuse, which is Linux based, and my
recollection is that Linux handles hardlinks to symlinks much longer
than it could set symlink timestamps.
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Description: OpenPGP digital signature
- Re: bug#8374: cp -a [-l] sometimes does not preserve timestamps of symlinks,
Eric Blake <=