bug-coreutils
[Top][All Lists]
Advanced

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

bug#7999: [coreutils-8.x] documentation of touch command needs clarifica


From: Eric Blake
Subject: bug#7999: [coreutils-8.x] documentation of touch command needs clarification
Date: Tue, 08 Feb 2011 08:22:31 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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