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.

Reply via email to