GNU bug report logs - #7529
Bug#605639: deal better with different filesystem timestamp resolutions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: jidanni <at> jidanni.org, 605639 <at> bugs.debian.org; dated Thu, 2 Dec 2010 01:04:02 UTC; Maintainer for coreutils is bug-coreutils <at> gnu.org.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Dec 2010 17:50:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 04 12:50:34 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1POwFm-0007tQ-LH
	for submit <at> debbugs.gnu.org; Sat, 04 Dec 2010 12:50:34 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim <at> meyering.net>) id 1POwFj-0007tE-FU
	for submit <at> debbugs.gnu.org; Sat, 04 Dec 2010 12:50:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POwLG-000519-LJ
	for submit <at> debbugs.gnu.org; Sat, 04 Dec 2010 12:56:18 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED,
	T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:41563)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POwLG-000514-J7
	for submit <at> debbugs.gnu.org; Sat, 04 Dec 2010 12:56:14 -0500
Received: from [140.186.70.92] (port=33958 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1POwLE-0007yo-7d
	for bug-coreutils <at> gnu.org; Sat, 04 Dec 2010 12:56:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POwLC-0004yu-Tx
	for bug-coreutils <at> gnu.org; Sat, 04 Dec 2010 12:56:11 -0500
Received: from mx.meyering.net ([82.230.74.64]:44286)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim <at> meyering.net>)
	id 1POwLC-0004xw-Aa; Sat, 04 Dec 2010 12:56:10 -0500
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id D59C1600E0; Sat,  4 Dec 2010 18:56:07 +0100 (CET)
From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#7529: Bug#605639: deal better with different
	filesystem	timestamp resolutions
In-Reply-To: <4CF93181.9060405 <at> cs.ucla.edu> (Paul Eggert's message of "Fri, 03
	Dec 2010 10:05:53 -0800")
References: <87y689uhta.fsf <at> jidanni.org> <4CF730CE.8070806 <at> cs.ucla.edu>
	<87zksn9nrj.fsf <at> meyering.net> <4CF93181.9060405 <at> cs.ucla.edu>
Date: Sat, 04 Dec 2010 18:56:07 +0100
Message-ID: <8762v9777s.fsf <at> meyering.net>
Lines: 27
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils <at> gnu.org, 605639 <at> bugs.debian.org,
	bug-gnulib <bug-gnulib <at> gnu.org>, jidanni <at> jidanni.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.6 (-----)

Paul Eggert wrote:

> On 12/03/10 02:03, Jim Meyering wrote:
>
>> Would you mind adding a "Bug fixes" entry for this
>> in coreutils' NEWS file?  It'd be nice to commit that
>> along with an update of the gnulib submodule to the latest.
>
> Sure, done, with this notice:
>
>   cp -u no longer does unnecessary copying merely because the source
>   has finer-grained time stamps than the destination.

Thanks!

>> As for a test, it shouldn't be too hard to create a root-only test
>> on linux/gnu systems, since _PC_TIMESTAMP_RESOLUTION is not defined.
>> Create two loop-mounted file systems of types that have the desired
>> difference in time stamp resolution, and run commands like Dan did.
>
> Hmm, well, I can see a lot going wrong with that, such as garbage in the
> mount table if the test is interrupted.  (Also, there's the little problem
> that I lack root access on the hosts that I do builds on these days: does
> that get me off the hook?  :-)

I didn't mean to make it sound like a requirement.
I was merely thinking aloud about how I might do it.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7529; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Dec 2010 18:00:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 03 13:00:24 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1POZvj-0006a0-Sk
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 13:00:24 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1POZvi-0006Zn-FN
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 13:00:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1POa1F-0003kw-Si
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 13:06:07 -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]:46611)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1POa1D-0003kQ-NA
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 13:06:05 -0500
Received: from [140.186.70.92] (port=45862 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1POa18-0003SR-RV
	for bug-coreutils <at> gnu.org; Fri, 03 Dec 2010 13:05:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1POa17-0003jD-8p
	for bug-coreutils <at> gnu.org; Fri, 03 Dec 2010 13:05:58 -0500
Received: from smtp.cs.ucla.edu ([131.179.128.62]:37885)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>)
	id 1POa17-0003j3-3P; Fri, 03 Dec 2010 13:05:57 -0500
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id B5B2639E80F9;
	Fri,  3 Dec 2010 10:05:54 -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 af7s3pQIU+gg; Fri,  3 Dec 2010 10:05:54 -0800 (PST)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
	by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2660A39E80F2;
	Fri,  3 Dec 2010 10:05:54 -0800 (PST)
Message-ID: <4CF93181.9060405 <at> cs.ucla.edu>
Date: Fri, 03 Dec 2010 10:05:53 -0800
From: Paul Eggert <eggert <at> cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10
MIME-Version: 1.0
To: Jim Meyering <jim <at> meyering.net>
Subject: Re: bug#7529: Bug#605639: deal better with different
	filesystem	timestamp resolutions
References: <87y689uhta.fsf <at> jidanni.org> <4CF730CE.8070806 <at> cs.ucla.edu>
	<87zksn9nrj.fsf <at> meyering.net>
In-Reply-To: <87zksn9nrj.fsf <at> meyering.net>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils <at> gnu.org, 605639 <at> bugs.debian.org,
	bug-gnulib <bug-gnulib <at> gnu.org>, jidanni <at> jidanni.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.0 (-----)

On 12/03/10 02:03, Jim Meyering wrote:

> Would you mind adding a "Bug fixes" entry for this
> in coreutils' NEWS file?  It'd be nice to commit that
> along with an update of the gnulib submodule to the latest.

Sure, done, with this notice:

  cp -u no longer does unnecessary copying merely because the source
  has finer-grained time stamps than the destination.

> As for a test, it shouldn't be too hard to create a root-only test
> on linux/gnu systems, since _PC_TIMESTAMP_RESOLUTION is not defined.
> Create two loop-mounted file systems of types that have the desired
> difference in time stamp resolution, and run commands like Dan did.

Hmm, well, I can see a lot going wrong with that, such as garbage in the
mount table if the test is interrupted.  (Also, there's the little problem
that I lack root access on the hosts that I do builds on these days: does
that get me off the hook?  :-)





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7529; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Dec 2010 09:57:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 03 04:57:57 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1POSOr-0007WH-2K
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 04:57:57 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <jim <at> meyering.net>) id 1POSOo-0007W0-Fw
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 04:57:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POSUL-000843-2L
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 05:03:38 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED,
	T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:50747)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POSUK-00083z-VD
	for submit <at> debbugs.gnu.org; Fri, 03 Dec 2010 05:03:37 -0500
Received: from [140.186.70.92] (port=40984 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1POSUK-0006kt-4B
	for bug-coreutils <at> gnu.org; Fri, 03 Dec 2010 05:03:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jim <at> meyering.net>) id 1POSUI-000838-HW
	for bug-coreutils <at> gnu.org; Fri, 03 Dec 2010 05:03:35 -0500
Received: from mx.meyering.net ([82.230.74.64]:33430)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jim <at> meyering.net>)
	id 1POSUI-00081Z-9a; Fri, 03 Dec 2010 05:03:34 -0500
Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
	id D1CEA600CD; Fri,  3 Dec 2010 11:03:28 +0100 (CET)
From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#7529: Bug#605639: deal better with different
	filesystem	timestamp resolutions
In-Reply-To: <4CF730CE.8070806 <at> cs.ucla.edu> (Paul Eggert's message of "Wed, 01
	Dec 2010 21:38:22 -0800")
References: <87y689uhta.fsf <at> jidanni.org> <4CF730CE.8070806 <at> cs.ucla.edu>
Date: Fri, 03 Dec 2010 11:03:28 +0100
Message-ID: <87zksn9nrj.fsf <at> meyering.net>
Lines: 48
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils <at> gnu.org, 605639 <at> bugs.debian.org,
	bug-gnulib <bug-gnulib <at> gnu.org>, jidanni <at> jidanni.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.6 (-----)

Paul Eggert wrote:
> Good eye!  Thanks for the bug report and example.  I installed
> the following one-byte patch into gnulib; please give it a try.
> It should propagate into coreutils the next time coreutils
> updates from gnulib.
>
> A test case for this would require two file systems, one with
> finer-grained time stamps than the other, where we can create
> files in the latter.  I suspect this goes beyond what coreutils's
> test cases can easily do.

Hi Paul,

Thanks for the speedy patch!
Would you mind adding a "Bug fixes" entry for this
in coreutils' NEWS file?  It'd be nice to commit that
along with an update of the gnulib submodule to the latest.

As for a test, it shouldn't be too hard to create a root-only test
on linux/gnu systems, since _PC_TIMESTAMP_RESOLUTION is not defined.
Create two loop-mounted file systems of types that have the desired
difference in time stamp resolution, and run commands like Dan did.

> Subject: [PATCH] utimecmp: fine-grained src to nearby coarse-grained dest
>
> * lib/utimecmp.c (utimecmp): When UTIMECMP_TRUNCATE_SOURCE is set,
> and the source is on a file system with higher-resolution time
> stamps, than the destination, and _PC_TIMESTAMP_RESOLUTION does
> not work, and the time stamps are close together, the algorithm to
> determine the exact resolution from the read-back mtime was buggy:
> it had a "!=" where it should have had an "==".  This bug has been
> in the code ever since it was introduced to gnulib.
> Problem reported by Dan Jacobson in
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7529>.
...
> diff --git a/lib/utimecmp.c b/lib/utimecmp.c
> index 63a0c9a..8c3ca65 100644
> --- a/lib/utimecmp.c
> +++ b/lib/utimecmp.c
> @@ -325,7 +325,7 @@ utimecmp (char const *dst_name,
>
>                  res = SYSCALL_RESOLUTION;
>
> -                for (a /= res; a % 10 != 0; a /= 10)
> +                for (a /= res; a % 10 == 0; a /= 10)
>                    {
>                      if (res == BILLION)
>                        {




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7529; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Dec 2010 05:33:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 02 00:33:09 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PO1mx-0001YX-Db
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2010 00:33:08 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1PO1mu-0001Y3-99
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2010 00:33:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1PO1sN-00049d-Ae
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2010 00:38:41 -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]:60256)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1PO1sN-00049E-0O
	for submit <at> debbugs.gnu.org; Thu, 02 Dec 2010 00:38:39 -0500
Received: from [140.186.70.92] (port=37124 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PO1sJ-0003lH-1Q
	for bug-coreutils <at> gnu.org; Thu, 02 Dec 2010 00:38:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>) id 1PO1sH-000486-AI
	for bug-coreutils <at> gnu.org; Thu, 02 Dec 2010 00:38:34 -0500
Received: from smtp.cs.ucla.edu ([131.179.128.62]:40833)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert <at> cs.ucla.edu>)
	id 1PO1sG-00047P-VU; Thu, 02 Dec 2010 00:38:33 -0500
Received: from localhost (localhost.localdomain [127.0.0.1])
	by smtp.cs.ucla.edu (Postfix) with ESMTP id BF0E639E80E0;
	Wed,  1 Dec 2010 21:38:29 -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 8trdd8B6-TT9; Wed,  1 Dec 2010 21:38:28 -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 ED1C839E80DC;
	Wed,  1 Dec 2010 21:38:27 -0800 (PST)
Message-ID: <4CF730CE.8070806 <at> cs.ucla.edu>
Date: Wed, 01 Dec 2010 21:38:22 -0800
From: Paul Eggert <eggert <at> cs.ucla.edu>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6
MIME-Version: 1.0
To: jidanni <at> jidanni.org, 605639 <at> bugs.debian.org
Subject: Re: bug#7529: Bug#605639: deal better with different
	filesystem	timestamp resolutions
References: <87y689uhta.fsf <at> jidanni.org>
In-Reply-To: <87y689uhta.fsf <at> jidanni.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -4.6 (----)
X-Debbugs-Envelope-To: submit
Cc: submit <at> bugs.debian.org, bug-gnulib <bug-gnulib <at> gnu.org>,
	bug-coreutils <at> gnu.org, bug-make <at> gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.6 (----)

Good eye!  Thanks for the bug report and example.  I installed
the following one-byte patch into gnulib; please give it a try.
It should propagate into coreutils the next time coreutils
updates from gnulib.

A test case for this would require two file systems, one with
finer-grained time stamps than the other, where we can create
files in the latter.  I suspect this goes beyond what coreutils's
test cases can easily do.

From 409c6b774c25afce33f8b67fbf7af3eb3304f6cf Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Wed, 1 Dec 2010 21:25:56 -0800
Subject: [PATCH] utimecmp: fine-grained src to nearby coarse-grained dest

* lib/utimecmp.c (utimecmp): When UTIMECMP_TRUNCATE_SOURCE is set,
and the source is on a file system with higher-resolution time
stamps, than the destination, and _PC_TIMESTAMP_RESOLUTION does
not work, and the time stamps are close together, the algorithm to
determine the exact resolution from the read-back mtime was buggy:
it had a "!=" where it should have had an "==".  This bug has been
in the code ever since it was introduced to gnulib.
Problem reported by Dan Jacobson in
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7529>.
---
 ChangeLog      |   14 ++++++++++++++
 lib/utimecmp.c |    2 +-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d4eb684..67e2977 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-01  Paul Eggert  <eggert <at> cs.ucla.edu>
+
+	utimecmp: fine-grained src to nearby coarse-grained dest
+
+	* lib/utimecmp.c (utimecmp): When UTIMECMP_TRUNCATE_SOURCE is set,
+	and the source is on a file system with higher-resolution time
+	stamps, than the destination, and _PC_TIMESTAMP_RESOLUTION does
+	not work, and the time stamps are close together, the algorithm to
+	determine the exact resolution from the read-back mtime was buggy:
+	it had a "!=" where it should have had an "==".  This bug has been
+	in the code ever since it was introduced to gnulib.
+	Problem reported by Dan Jacobson in
+	<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7529>.
+
 2010-11-30  Bruno Haible  <bruno <at> clisp.org>
 
 	strerror_r-posix: Fix autoconf test.
diff --git a/lib/utimecmp.c b/lib/utimecmp.c
index 63a0c9a..8c3ca65 100644
--- a/lib/utimecmp.c
+++ b/lib/utimecmp.c
@@ -325,7 +325,7 @@ utimecmp (char const *dst_name,
 
                 res = SYSCALL_RESOLUTION;
 
-                for (a /= res; a % 10 != 0; a /= 10)
+                for (a /= res; a % 10 == 0; a /= 10)
                   {
                     if (res == BILLION)
                       {
-- 
1.7.2





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7529; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Dec 2010 01:03:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 01 20:03:38 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PNxaE-0004Ft-0P
	for submit <at> debbugs.gnu.org; Wed, 01 Dec 2010 20:03:38 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs <at> busoni.debian.org>) id 1PNxaB-0004Fg-K0
	for submit <at> debbugs.gnu.org; Wed, 01 Dec 2010 20:03:36 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <debbugs <at> busoni.debian.org>) id 1PNxff-0001k4-5F
	for submit <at> debbugs.gnu.org; Wed, 01 Dec 2010 20:09:16 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, RCVD_IN_NJABL_PROXY, 
	T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:55450)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <debbugs <at> busoni.debian.org>) id 1PNxff-0001jy-1x
	for submit <at> debbugs.gnu.org; Wed, 01 Dec 2010 20:09:15 -0500
Received: from [140.186.70.92] (port=48335 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PNxfd-00020A-QB
	for bug-coreutils <at> gnu.org; Wed, 01 Dec 2010 20:09:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <debbugs <at> busoni.debian.org>) id 1PNxfc-0001jL-IT
	for bug-coreutils <at> gnu.org; Wed, 01 Dec 2010 20:09:13 -0500
Received: from busoni.debian.org ([140.211.15.34]:36577)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <debbugs <at> busoni.debian.org>)
	id 1PNxfZ-0001i2-Vd; Wed, 01 Dec 2010 20:09:10 -0500
Received: from debbugs by busoni.debian.org with local (Exim 4.69)
	(envelope-from <debbugs <at> busoni.debian.org>)
	id 1PNxfU-000375-8n; Thu, 02 Dec 2010 01:09:04 +0000
X-Loop: owner <at> bugs.debian.org
Subject: Bug#605639: deal better with different filesystem timestamp
	resolutions
Resent-From: jidanni <at> jidanni.org
Resent-To: debian-bugs-dist <at> lists.debian.org
Resent-CC: bug-coreutils <at> gnu.org, bug-make <at> gnu.org,
	Michael Stone <mstone <at> debian.org>
X-Loop: owner <at> bugs.debian.org
Resent-Date: Thu, 02 Dec 2010 01:09:01 +0000
Resent-Message-ID: <handler.605639.B.129125189111080 <at> bugs.debian.org>
X-Debian-PR-Message: report 605639
X-Debian-PR-Package: coreutils
X-Debian-PR-Keywords: 
X-Debian-PR-Source: coreutils
Received: via spool by submit <at> bugs.debian.org id=B.129125189111080
	(code B ref -1); Thu, 02 Dec 2010 01:09:01 +0000
Received: (at submit) by bugs.debian.org; 2 Dec 2010 01:04:51 +0000
Received: from caiajhbdcbef.dreamhost.com ([208.97.132.145]
	helo=homiemail-a61.g.dreamhost.com)
	by busoni.debian.org with esmtp (Exim 4.69)
	(envelope-from <jidanni <at> jidanni.org>) id 1PNxbP-0002sM-2D
	for submit <at> bugs.debian.org; Thu, 02 Dec 2010 01:04:51 +0000
Received: from homiemail-a61.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a61.g.dreamhost.com (Postfix) with ESMTP id 4A79257807B
	for <submit <at> bugs.debian.org>; Wed,  1 Dec 2010 17:04:48 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=jidanni.org; h=from:to:subject
	:date:message-id:mime-version:content-type; q=dns; s=jidanni.org
	; b=gjhtFR4H0HTMJKNndVXKlNiKrsfv4P1C8imUq86m/kseVoDWL1WPk/TmqzQD
	rCqKV5vfto/pHTa/GQE7Z6u9lCQVa7zb/Vl7ExJYB5NvTGSgEfxWHwOq0d2FcqCf
	kXhz1xyr5WTtTELh51/S6shMqYbWK6l9g0rLgM3O5JAnLoQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
	:subject:date:message-id:mime-version:content-type; s=
	jidanni.org; bh=eNS6rb27qlE2hDl6GjnOHVbTauE=; b=JWpCcM52IeDlWdi+
	DJPzPSCXHA1LUoLl42Yo3c1Rx6/w/3KFLmRcwct4PHsAtM8Ii+VB5jBw/r9NEpPL
	y7pwSJBdR7d/DACfQ5jotyr0st5zwFMlhTGy7qc6wOIJ2TRWtQKYxyiO7bUSGlHl
	f56dH4VEzqEzY43AAsiFpYS6sI4=
Received: from jidanni.org (218-163-2-222.dynamic.hinet.net [218.163.2.222])
	(using TLSv1 with cipher AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jidanni <at> jidanni.org)
	by homiemail-a61.g.dreamhost.com (Postfix) with ESMTPSA id E7B55578059
	for <submit <at> bugs.debian.org>; Wed,  1 Dec 2010 17:04:46 -0800 (PST)
From: jidanni <at> jidanni.org
To: submit <at> bugs.debian.org
Date: Thu, 02 Dec 2010 08:41:53 +0800
Message-ID: <87y689uhta.fsf <at> jidanni.org>
MIME-Version: 1.0
Content-Type: text/plain
Delivered-To: submit <at> bugs.debian.org
Resent-Sender: Debian BTS <debbugs <at> busoni.debian.org>
Resent-Date: Thu, 02 Dec 2010 01:09:04 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -4.5 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: jidanni <at> jidanni.org, 605639 <at> bugs.debian.org
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.5 (----)

X-Debbugs-cc: bug-coreutils <at> gnu.org, bug-make <at> gnu.org
Package: coreutils
Version: 8.5-1

man cp says:
`-u'
`--update'
     Do not copy a non-directory that has an existing destination with
     the same or newer modification time.  If time stamps are being
     preserved, the comparison is to the source time stamp truncated to
     the resolutions of the destination file system and of the system
     calls used to update time stamps; this avoids duplicate work if
     several `cp -pu' commands are executed with the same source and
     destination.

But it seems that isn't working too much/well,

$ touch /tmp/f
$ /bin/cp -avu /tmp/f .
`/tmp/f' -> `./f'
$ /bin/cp -avu /tmp/f .
`/tmp/f' -> `./f'
$ /bin/cp -avu /tmp/f .
`/tmp/f' -> `./f'
$ ls -l --full-time f /tmp/f
-rw-r--r-- 1 jidanni jidanni 0 2010-12-02 08:25:47.682527260 +0800 /tmp/f
-rw-r--r-- 1 jidanni jidanni 0 2010-12-02 08:25:47.000000000 +0800 f
$ mount
/dev/sda6 on /home type ext3 (rw)
tmpfs on /tmp type tmpfs (rw)

It might work great f -> /tmp/f, but not the other way around.

By the way, make(1) lacks any of this time comparison resolution
machinery at all! I'll CC them.






Acknowledgement sent to jidanni <at> jidanni.org, 605639 <at> bugs.debian.org:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org, bug-make <at> gnu.org, bug-coreutils <at> gnu.org. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org, bug-make <at> gnu.org, bug-coreutils <at> gnu.org:
bug#7529; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 20 Sep 2011 19:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.