[Top][All Lists]

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

[Bug-gnulib] Re: Bug#202243: glibc utimes glitch with coreutils 'touch'

From: Paul Eggert
Subject: [Bug-gnulib] Re: Bug#202243: glibc utimes glitch with coreutils 'touch'
Date: 18 Aug 2003 13:30:24 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

GOTO Masanori <address@hidden> writes:

> "Historically, utimes truncated when it couldn't store the
> microseconds" is BSD's original implementation?

Yes.  I don't know where that phrase in the standard about "rounding"
came from.  Quite possibly it's just a glitch in the standard, and
"truncating" was intended.

Historically, time-related code has always truncated.  For example,
the time() system call, "ls -l", and "date" all truncate.  There are
good reasons for preferring truncation to rounding in timestamps,
despite the greater numeric error.  For example, truncating makes it
easier to answer the question "Was that file modified before
midnight?" when you are looking at lower-resolution timestamps.  And
double-truncation is exact, whereas double-rounding can introduce
extra errors.

When 'utimes()' rounds, it can break applications like 'cp -p' and
'make', because it can cause file timestamps to be in the future
when the timestamps are copied from just-created files.

The current coreutils CVS works around this problem by avoiding
'utimes' if it detects that 'utimes' rounds.  This is unfortunate,
because it disables support for sub-second timestamps in 'cp -p' under
glibc; but at least it doesn't break 'make'.

Please fix this problem by applying the patch in
That will enable coreutils 'cp' to support sub-second timestamps.


reply via email to

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