[Top][All Lists]

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

Re: Linux 2.6 nanosecond time stamp weirdness breaks GCC build

From: Paul Eggert
Subject: Re: Linux 2.6 nanosecond time stamp weirdness breaks GCC build
Date: Thu, 01 Apr 2004 16:35:20 -0800
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (usg-unix-v)

On Thu, Apr 01, 2004 at 10:09:57PM +0200, Andi Kleen wrote:

> just round up to the next second instead of rounding down when going
> from 1s resolution to ns.

Please don't do that.  Longstanding tradition in timestamp code is to
truncate toward minus infinity when converting from a
higher-resolution timestamp to a lower-resolution timestamp.  This
is consistent behavior, and is easy to explain: let's stick to it as a
uniform practice.

There are two basic principles here.  First, ordinary files should not
change spontaneously: hence a file's timestamp should not change
merely because its inode is no longer cached.  Second, a file's
timestamp should never be "in the future": hence one should never
round such timestamps up.

The only way I can see to satisfy these two principles is to truncate
the timestamp right away, when it is first put into the inode cache.
That way, the copy in main memory equals what will be put onto disk.
This is the approach taken by other operating systems like Solaris,
and it explains why parallel GCC builds won't have this problem on
these other systems.

Switching subjects slightly, in
I recently contributed code to coreutils that fixes some bugs with "cp
--update" and "mv --update" when files are copied from
high-resolution-timestamp file systems to low-resolution-timestamp
file systems.  This code dynamically determines the timestamp
resolution of a file system by examining (and possibly mutating) its
timestamps.  The current Linux+ext3 behavior (which I did not know
about) breaks this code, because it can cause "cp" to falsely think
that ext3 has nanosecond-resolution timestamps.

How long has the current Linux+ext3 behavior been in place?  If it's
widespread, I'll probably have to think about adding a workaround to
coreutils.  Does the behavior affect all Linux filesystems, or just

I'll CC: this message to bug-coreutils to give them a heads-up.

reply via email to

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