On 11/11/2010 03:45 PM, Eric Blake wrote:
> On 11/11/2010 04:32 PM, Bruno Haible wrote:
>>   - Is glibc's futimes() implementation correct? Is futimes() allowed to 
>> round
>>     up by as much as half a second?
> 
> No.

Eric is right.  The POSIX spec for futimens, utimensat, and utimes says
"The file's relevant timestamp shall be set to the greatest value
supported by the file system that is not greater than the specified time".
POSIX doesn't govern futimes but it is clearly a bug if futimes behaves
differently from the standard functions in this respect.

I assume that the workaround is to stat the file on potentially-buggy systems, 
and
to redo the futimes call if it appears to have triggered the bug.  What a
hassle.

It's plausible that futimesat and lutimes would have the same bug as futimes.

The glibc bug was introduced in 2003.  I reported it back then;
see <http://sources.redhat.com/ml/libc-alpha/2003-08/msg00062.html>.
The bug was fixed in Debian; see
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=202243>.
It'd be nice if someone would fix it in glibc upstream, too.

Reply via email to