From: ludo@gnu.org (Ludovic Courtès)
To: "Pádraig Brady" <P@draigBrady.com>
Cc: bug-gnulib@gnu.org, 20597@debbugs.gnu.org
Subject: bug#20597: ‘unlinkat’ bug in Linux 4.0.2 leads to tar test failure
Date: Sun, 24 May 2015 15:53:07 +0200 [thread overview]
Message-ID: <874mn26q0s.fsf__9069.10102717138$1432475660$gmane$org@gnu.org> (raw)
In-Reply-To: <5561BCC4.6040604@draigBrady.com> ("Pádraig Brady"'s message of "Sun, 24 May 2015 12:57:56 +0100")
Pádraig Brady <P@draigBrady.com> skribis:
> On 24/05/15 12:33, Ludovic Courtès wrote:
[...]
>> unlinkat(4, "foo_file", 0) = 0
>> unlinkat(AT_FDCWD, "foo", AT_REMOVEDIR) = 0
>> unlinkat(5, "bar_file", 0) = 0
>> unlinkat(4, "../bar", AT_REMOVEDIR) = -1 ENOENT (No such file or directory)
>> --8<---------------cut here---------------end--------------->8---
>>
>> Contrast this with the same thing on 4.0.4-gnu:
>>
>> --8<---------------cut here---------------start------------->8---
>> unlinkat(4, "foo_file", 0) = 0
>> unlinkat(AT_FDCWD, "foo", AT_REMOVEDIR) = 0
>> unlinkat(5, "bar_file", 0) = 0
>> unlinkat(4, "../bar", AT_REMOVEDIR) = 0
>> --8<---------------cut here---------------end--------------->8---
>>
>> So this looks like a 4.0.2 kernel bug that Gnulib’s unlinkat should
>> perhaps work around.
>>
>> Thoughts?
>
> Maybe. How widely deployed was 4.0.2 (It's not used in Red Hat land for example).
> How many versions was the bug present for?
I don’t know, and I haven’t been able to find traces of a fix in that
area in the kernel.
OTOH, after rereading the analysis at
<http://lists.gnu.org/archive/html/bug-tar/2014-08/msg00010.html>, it
may be that the 4.0.2 behavior is POSIX-conforming, in which case we’d
rather fix tar (or its tests) instead:
The BSD behavior appears to be in line with POSIX. unlinkat() with
AT_REMOVEDIR is equivalent to rmdir(), whose specification says:
If one or more processes have the directory open when the last
link is removed, the dot and dot-dot entries, if present, shall
be removed before rmdir() returns and no new entries may be created
in the directory, but the directory shall not be removed until
all references to the directory are closed.
Without "..", the path resolution of the subsequent unlinkat() call
should--or at least can--fail.
WDYT?
Thanks,
Ludo’.
next prev parent reply other threads:[~2015-05-24 13:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-17 7:23 bug#20597: GNU tar fails test suite Andrew Patterson
2015-05-19 15:42 ` Ludovic Courtès
[not found] ` <5561771F.2010203@uwaterloo.ca>
2015-05-24 11:33 ` bug#20597: ‘unlinkat’ bug in Linux 4.0.2 leads to tar test failure Ludovic Courtès
[not found] ` <87617i9plu.fsf_-_@gnu.org>
2015-05-24 11:57 ` Pádraig Brady
[not found] ` <5561BCC4.6040604@draigBrady.com>
2015-05-24 13:53 ` Ludovic Courtès [this message]
[not found] ` <874mn26q0s.fsf@gnu.org>
2015-05-24 14:19 ` Pádraig Brady
[not found] ` <5561DDD7.2020107@draigBrady.com>
2015-05-24 14:48 ` Paul Eggert
2015-05-24 21:43 ` Andy Patterson
2015-05-25 12:55 ` Ludovic Courtès
2015-06-15 22:30 ` bug#20597: GNU tar fails test suite Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='874mn26q0s.fsf__9069.10102717138$1432475660$gmane$org@gnu.org' \
--to=ludo@gnu.org \
--cc=20597@debbugs.gnu.org \
--cc=P@draigBrady.com \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.