bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug 552320] Handling AT_FDCWD as EBADF in glibc's utimens() causes


From: Eric Blake
Subject: Re: [Bug 552320] Handling AT_FDCWD as EBADF in glibc's utimens() causes tar failures
Date: Wed, 06 Jan 2010 06:20:51 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

According to Jim Meyering on 1/5/2010 2:07 PM:
>> --- Comment #5 from Ondrej Vasik <address@hidden>  2010-01-05 14:29:13 EDT 
>> ---
>> Ah - even the latest gnulib doesn't handle this new recent change - so touch
>> from coreutils might be affected as well as mentioned in debian bugzilla from
>> comment #4. Therefore adding coreutils/gnulib upstream maintainer into CC.

For the record, the bug occurs any time something calls fdutimens
(negative, name, t) trying to change the timestamp of name with no fd
present, and only occurs on platforms running an old kernel (2.6.18 or
older, where utimensat syscall fails with ENOSYS) but new glibc (2.11.1 or
newer, where the futimens wrapper failing with EBADF masks the desired
ENOSYS that we used to get from the kernel).  It dates back to gnulib
commit faeb3e6b2, May 2008, when fdutimens (also known as gl_utimens or
even futimens, back before POSIX standardized the name futimens with a
different signature) first started using the utimensat syscall.  This
corresponds to coreutils 6.12 being the first buggy version.

Inspecting the coreutils sources, the following scenarios appear to be the
only possible places affected by the bug.

touch -c on any type of existing file
touch -h on non-symlink (introduced in 8.1)

In copy.c, copy_reg is immune (fd is always non-negative), only
copy_internal is affected.  But that means that:

cp --preserve=timestamps
install -p
mv (across device boundary)

are affected when operating on directories, symlinks, fifos, ...

So, how about this NEWS item?

diff --git a/NEWS b/NEWS
index 42a8f47..686ed56 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ GNU coreutils NEWS                                    -*-
outline -*-

 ** Bug fixes

+  cp -p, install -p, mv, and touch -c could trigger a spurious error
+  message when using new glibc coupled with an old kernel.
+  [bug introduced in coreutils-6.12].
+
   ls -l --color no longer prints "argetm" in front of dangling
   symlinks when the 'LINK target' directive was given to dircolors.
   [bug introduced in fileutils-4.0]


-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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