[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fts: is an O_NOFOLLOW missing in fts_build / opendirat?
From: |
Jim Meyering |
Subject: |
Re: fts: is an O_NOFOLLOW missing in fts_build / opendirat? |
Date: |
Mon, 13 Sep 2010 10:02:42 +0200 |
Paul Eggert wrote:
> I hope you don't mind a bit more code inspection of fts.c by someone
> who doesn't fully grok the code yet.
>
> I see that openat for directories is used in two places. One place
> uses O_NOFOLLOW if FTS_PHYSICAL is set; the other always follows
> symlinks. Is that intended? That is, wouldn't something like the
> following untested patch make sense, to avoid a race condition where
> a symlink replaces a directory?
I ran this test: apply your patch, compile everything and
run coreutils' "make check" tests. With this change, 4 tests fail:
$ grep FAIL tests/test-suite.log
FAIL: chgrp/posix-H (exit: 1)
FAIL: chgrp/recurse (exit: 1)
FAIL: du/deref (exit: 1)
FAIL: du/deref-args (exit: 1)
I haven't yet had time to look carefully, but those failures suggest that
such a change would also have to account for the FTS_COMFOLLOW option,
which may be set along with FTS_PHYSICAL.