GNU bug report logs -
#7999
[coreutils-8.x] documentation of touch command needs clarification
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 02/07/2011 04:36 PM, Nelson H. F. Beebe wrote:
> If I want to guarantee identical timestamps, am I forced to use a
> temporary reference file, perhaps like this?
>
> touch /tmp/TIMESTAMP.$$
> touch -r /tmp/TIMESTAMP.$$ first second ... umpteenth
> rm -f /tmp/TIMESTAMP.$$
Yes, if you want guaranteed equivalence in timestamps, you must use a
reference file.
On 02/07/2011 10:37 PM, Paul Eggert wrote:
> On 02/07/2011 03:36 PM, Nelson H. F. Beebe wrote:
>> Perhaps the coreutils manual page and info documentation could be
>> updated to document what that implementation does, and discuss whether
>> it agrees or differs from other implementations (and POSIX).
>
> If A and B both exist, then "touch A B" might set A's time stamp
> to be earlier than B's, or later than B's, or they might
> be set to exactly the same time. POSIX doesn't say, and I suspect that
> for efficiency reasons coreutils's documentation shouldn't say
> either (except perhaps to say that it doesn't say :-).
Well, POSIX generally states that arguments are process left-to-right,
so A should be processed before B. However, depending on whether time
was cached when touch first started, or updated for each file touched,
affects whether A < B or A == B. Then there's the matter of multiple
mount points, where different precision between mount points (or even
differing NFS clocks) can indeed lead to B > A, without any loss of
generality (since POSIX is silent on the matter of intra-file relations
within a single touch invocation).
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 13 years and 222 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.