bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp -p loses precision on the timestamp of the copy


From: Eric Blake
Subject: Re: cp -p loses precision on the timestamp of the copy
Date: Sat, 02 Feb 2008 08:10:40 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Ray Liere on 2/2/2008 7:47 AM:
| I was thrown by it because I had written some code that "assumed"
| that, regardless of what timestamp precision existed on a particular
| computer, all of linux would be consistent and either use the extended
| precision or not.

| utimes("jnkcopy2", {1201833653, 245502}) = 0

No - the problem is more fundamental than that: that older versions of
Linux do not even HAVE a way to set timestamps less than microsecond
resolution.  Your trace shows that coreutils used utimes, which used to be
the only way to set timetamps, but which inherently does not support
nanosecond resolutions.  futimensat is a relatively new invention, and
prior to it, there just wasn't a way to set the necessary precision.  But
you are also right that older coreutils won't use futimensat even if it is
available on a newer kernel; you need new software on both fronts to get
the advantage of setting nanosecond resoultion on timestamps.  Once you
have the new syscall, and the new coreutils that uses the new syscall,
then resolution is set to the maximum allowed by the filesystem that the
file is on (not necessarily the same granularity on different file systems).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHpIfv84KuGfSFAYARAp4DAJ4gPnQ+UJJ06W+hXR1IEPtmmxT+ogCeIYys
CGmRdvx0J+A/3tLM9C1oYAo=
=Afu9
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]