From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 07 19:13:55 2011 Received: (at submit) by debbugs.gnu.org; 8 Feb 2011 00:13:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmbDO-0003Sq-M9 for submit@debbugs.gnu.org; Mon, 07 Feb 2011 19:13:55 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmbDM-0003Sa-I8 for submit@debbugs.gnu.org; Mon, 07 Feb 2011 19:13:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmbLj-0004EM-S9 for submit@debbugs.gnu.org; Mon, 07 Feb 2011 19:22:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:40614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmbLj-0004EH-P0 for submit@debbugs.gnu.org; Mon, 07 Feb 2011 19:22:31 -0500 Received: from [140.186.70.92] (port=54243 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmbLi-0001aE-Lj for bug-coreutils@gnu.org; Mon, 07 Feb 2011 19:22:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmbLh-0004Da-82 for bug-coreutils@gnu.org; Mon, 07 Feb 2011 19:22:30 -0500 Received: from mail.math.utah.edu ([155.101.98.135]:54998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmbLh-0004D2-0l for bug-coreutils@gnu.org; Mon, 07 Feb 2011 19:22:29 -0500 Received: from psi.math.utah.edu (psi.math.utah.edu [155.101.96.19]) by mail.math.utah.edu (8.14.4/8.14.4) with ESMTP id p17NakXR024748; Mon, 7 Feb 2011 16:36:46 -0700 (MST) Received: from psi.math.utah.edu (localhost [127.0.0.1]) by psi.math.utah.edu (8.14.4/8.14.4) with ESMTP id p17NakNw008110; Mon, 7 Feb 2011 16:36:46 -0700 (MST) Received: (from beebe@localhost) by psi.math.utah.edu (8.14.4/8.14.4/Submit) id p17Nakqe008108; Mon, 7 Feb 2011 16:36:46 -0700 (MST) Date: Mon, 7 Feb 2011 16:36:46 -0700 (MST) From: "Nelson H. F. Beebe" To: bug-coreutils@gnu.org X-US-Mail: "Department of Mathematics, 110 LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT 84112-0090, USA" X-Telephone: +1 801 581 5254 X-FAX: +1 801 585 1640, +1 801 581 4148 X-URL: http://www.math.utah.edu/~beebe Subject: [coreutils-8.x] documentation of touch command needs clarification Message-ID: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (mail.math.utah.edu [155.101.98.135]); Mon, 07 Feb 2011 16:36:46 -0700 (MST) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 155.101.98.135 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit Cc: beebe@math.utah.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Examination of the info documention for the coreutils-8.x implementation of the touch command, and the POSIX (IEEE Std 1003.1-2001), does not make clear exactly what time is used when the argument files exist, and no time specifier (-r or -t option) is supplied. For example, touch first second .... umpteenth If the files do not exist, then POSIX says 35294 1. If file does not exist, a creat( ) function call is made with the file operand used as the path 35295 argument and the value of the bitwise-inclusive OR of S_IRUSR, S_IWUSR, S_IRGRP, 35296 S_IWGRP, S_IROTH, and S_IWOTH used as the mode argument. That implies that each newly-created file gets the time of its creation, so the timestamps should be expected to differ if the clock resolution is not too coarse. However, if the files already exist, what happens? Should the files all get the same timestamp, or the timestamp in effect when the touch of that file actually occurred? 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.$$ 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). Because file timestamps are used heavily by commands like "make" and "rsync", it can be important to know how the touch command does its job. An experiment on SGI IRIX (a system with microsecond-resolution timestamps) with coreutils-7.5 shows that the touch command from that release has a new time for each file: % /usr/local/bin/touch /tmp/fee.{`seq -s , 1000 2000`} % /usr/local/bin/touch /tmp/fee.{`seq -s , 1000 2000`} % stat /tmp/fee.?000 File: `/tmp/fee.1000' ... Access: 2011-02-07 16:27:07.332753000 -0700 ... File: `/tmp/fee.2000' ... Access: 2011-02-07 16:27:09.934987800 -0700 Similar behavior is found with coreutils-8.9 on NetBSD IA-32 and Sun Solaris SPARC. ------------------------------------------------------------------------------- - Nelson H. F. Beebe Tel: +1 801 581 5254 - - University of Utah FAX: +1 801 581 4148 - - Department of Mathematics, 110 LCB Internet e-mail: beebe@math.utah.edu - - 155 S 1400 E RM 233 beebe@acm.org beebe@computer.org - - Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ - ------------------------------------------------------------------------------- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 08 00:28:38 2011 Received: (at 7999) by debbugs.gnu.org; 8 Feb 2011 05:28:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pmg7y-0003lH-0d for submit@debbugs.gnu.org; Tue, 08 Feb 2011 00:28:38 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pmg7w-0003l5-4s for 7999@debbugs.gnu.org; Tue, 08 Feb 2011 00:28:36 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id A251A39E80F0; Mon, 7 Feb 2011 21:37:16 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N0E8GgRirgsv; Mon, 7 Feb 2011 21:37:16 -0800 (PST) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3B1A039E8083; Mon, 7 Feb 2011 21:37:16 -0800 (PST) Message-ID: <4D50D68B.2040209@cs.ucla.edu> Date: Mon, 07 Feb 2011 21:37:15 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: "Nelson H. F. Beebe" Subject: Re: bug#7999: [coreutils-8.x] documentation of touch command needs clarification References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 7999 Cc: 7999@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) 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 :-). The same thing is true, in general, for other coreutils applications. For example, "cat A B" might set A's last-access time to be less than B's, or greater than B's, or equal to B's. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 08 10:13:53 2011 Received: (at 7999) by debbugs.gnu.org; 8 Feb 2011 15:13:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmpGL-0000hx-MA for submit@debbugs.gnu.org; Tue, 08 Feb 2011 10:13:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmpGJ-0000hk-GU for 7999@debbugs.gnu.org; Tue, 08 Feb 2011 10:13:52 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p18FMWH1004228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Feb 2011 10:22:32 -0500 Received: from [10.3.113.122] (ovpn-113-122.phx2.redhat.com [10.3.113.122]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p18FMVCo022038; Tue, 8 Feb 2011 10:22:32 -0500 Message-ID: <4D515FB7.1060905@redhat.com> Date: Tue, 08 Feb 2011 08:22:31 -0700 From: Eric Blake Organization: Red Hat 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 MIME-Version: 1.0 To: "Nelson H. F. Beebe" Subject: Re: bug#7999: [coreutils-8.x] documentation of touch command needs clarification References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig054E0522D11C3DE7BDA782CD" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.2 (----------) X-Debbugs-Envelope-To: 7999 Cc: 7999@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig054E0522D11C3DE7BDA782CD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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? >=20 > 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 =3D=3D 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). --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig054E0522D11C3DE7BDA782CD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNUV+3AAoJEKeha0olJ0NqK78H/R+FvGI2+SCdwyXHx6fkbgGs ekzyhoe62fI5CVBOIdC1Jw1BVbSbOpWeTHCCfxTpvUE8tiJYNeNHdkxUWZdFHPC+ Y6TwHkMOby7jJtGo89/W/b8CX5XGnmcwMEY/dT48SZwQlpzXhE/BvF2EahlatS7i A1V9qi0KzgXWsjgpxvrJ3zA4LVPyMFfxNx3DVrVhm3ExwkJ9leCCBXcmJTVfyUCd f4sxPHbgs1fBhL0qXi+Som/5O9czUq9XRYCI+Sn8d2/PMDZLEP9aCSZ3DRauA5zz ZBxdHKkFzLjSbaAcnhn4pV/KD4/nfWzYsZm2v32BEk8dz1a1aSjIXpjH0zZ+vuQ= =BP7Y -----END PGP SIGNATURE----- --------------enig054E0522D11C3DE7BDA782CD-- From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 12 20:00:59 2011 Received: (at 7999-done) by debbugs.gnu.org; 13 Dec 2011 01:00:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RaGjr-0001UT-Gm for submit@debbugs.gnu.org; Mon, 12 Dec 2011 20:00:59 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RaGjo-0001UK-Mi for 7999-done@debbugs.gnu.org; Mon, 12 Dec 2011 20:00:58 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C56B239E8008; Mon, 12 Dec 2011 16:59:40 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yF-wWdrQnfam; Mon, 12 Dec 2011 16:59:40 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2481139E8006; Mon, 12 Dec 2011 16:59:40 -0800 (PST) Message-ID: <4EE6A37B.40407@cs.ucla.edu> Date: Mon, 12 Dec 2011 16:59:39 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 MIME-Version: 1.0 To: "Nelson H. F. Beebe" Subject: Re: bug#7999: [coreutils-8.x] documentation of touch command needs clarification References: <4D50D68B.2040209@cs.ucla.edu> In-Reply-To: <4D50D68B.2040209@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 7999-done Cc: 7999-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) I installed the following patch to try to document this issue better and am taking the liberty of marking this as done. Further comments are welcome (and we can reopen the bug as needed). doc: document 'touch' and timestamps better * doc/coreutils.texi (touch invocation): Explain file timestamps better. Problem reported by Nelson H.F. Beebe (Bug#7999). diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 369fad2..c26a53d 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7199,6 +7199,7 @@ a date like @samp{Mar 30@ @ 2002} for non-recent timestamps, and a date-without-year and time like @samp{Mar 30 23:45} for recent timestamps. This format can change depending on the current locale as detailed below. +@cindex clock skew A timestamp is considered to be @dfn{recent} if it is less than six months old, and is not dated in the future. If a timestamp dated today is not listed in recent form, the timestamp is in the future, @@ -10261,11 +10262,39 @@ A @var{file} argument string of @samp{-} is handled specially and causes @command{touch} to change the times of the file associated with standard output. +@cindex clock skew +By default, @command{touch} sets file timestamps to the current time. +Because @command{touch} acts on its operands left to right, the +resulting timestamps of earlier and later operands may disagree. +Also, the determination of what time is ``current'' depends on the +platform. Platforms with network file systems often use different +clocks for the operating system and for file systems; because +@command{touch} typically uses file systems' clocks by default, clock +skew can cause the resulting file timestamps to appear to be in a +program's ``future'' or ``past''. + +@cindex file timestamp resolution +The @command{touch} command sets the file's timestamp to the greatest +representable value that is not greater than the requested time. This +can differ from the requested time for several reasons. First, the +requested time may have a higher resolution than supported. Second, a +file system may use different resolutions for different types of +times. Third, file timestamps may use a different resolution than +operating system timestamps. Fourth, the operating system primitives +used to update timestamps may employ yet a different resolution. For +example, in theory a file system might use 10-microsecond resolution +for access time and 100-nanosecond resolution for modification time, +and the operating system might use nanosecond resolution for the +current time and microsecond resolution for the primitive that +@command{touch} uses to set a file's timestamp to an arbitrary value. + @cindex permissions, for changing file timestamps -If changing both the access and modification times to the current -time, @command{touch} can change the timestamps for files that the user -running it does not own but has write permission for. Otherwise, the -user must own the files. +When setting file timestamps to the current time, @command{touch} can +change the timestamps for files that the user does not own but has +write permission for. Otherwise, the user must own the files. Some +older systems have a further restriction: the user must own the files +unless both the access and modification times are being set to the +current time. Although @command{touch} provides options for changing two of the times---the times of last access and modification---of a file, there is actually From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 13 02:10:59 2011 Received: (at 7999) by debbugs.gnu.org; 13 Dec 2011 07:10:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RaMVv-0001UR-3u for submit@debbugs.gnu.org; Tue, 13 Dec 2011 02:10:59 -0500 Received: from mx.meyering.net ([88.168.87.75]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RaMVu-0001UK-1N for 7999@debbugs.gnu.org; Tue, 13 Dec 2011 02:10:58 -0500 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id D83DE60039; Tue, 13 Dec 2011 08:09:40 +0100 (CET) From: Jim Meyering To: 7999@debbugs.gnu.org Subject: Re: bug#7999: [coreutils-8.x] documentation of touch command needs clarification In-Reply-To: <4EE6A37B.40407@cs.ucla.edu> (Paul Eggert's message of "Mon, 12 Dec 2011 16:59:39 -0800") References: <4D50D68B.2040209@cs.ucla.edu> <4EE6A37B.40407@cs.ucla.edu> Date: Tue, 13 Dec 2011 08:09:40 +0100 Message-ID: <878vmht0az.fsf@rho.meyering.net> Lines: 6 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7999 Cc: eggert@cs.ucla.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Paul Eggert wrote: > I installed the following patch to try to document this issue better > and am taking the liberty of marking this as done. Further comments > are welcome (and we can reopen the bug as needed). Nice. Thanks! From unknown Tue Jun 17 22:29:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 10 Jan 2012 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator