bug-coreutils
[Top][All Lists]
Advanced

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

Re: Wrong diagnostic when moving file from unwritable dir


From: Jim Meyering
Subject: Re: Wrong diagnostic when moving file from unwritable dir
Date: Mon, 24 Sep 2007 15:54:49 +0200

Andreas Schwab <address@hidden> wrote:

> When moving a file between filesystems, and the source directory is
> unwritable, the diagnostic given by mv is wrong:
>
> $ mkdir /tmp/x; touch /tmp/x/y; chmod -w /tmp/x
> $ test $(stat -c %d /tmp/x) -ne $(stat -c %d .); echo $?
> 0
> $ mv /tmp/x/y .
> mv: cannot remove `/tmp/x/y': Not a directory

Thanks for the report.
That was fixed by this recent change to remove.c:
[I'll mention in NEWS that the fix also affects cross-partition-mv]

2007-09-22  Jim Meyering  <address@hidden>

        rm: give a sensible diagnostic when failing to remove a symlink
        On some systems (those with openat et al), when rm would fail to
        remove a symlink, it would fail with the misleading diagnostic,
        "Too many levels of symbolic links".
        * NEWS: Mention the bug fix.
        * src/remove.c (is_nondir_lstat): New function.
        (remove_entry): Use it to catch failed-to-remove symlink (and any
        other non-dir) here so that we don't fall through and try to treat
        it as directory, which -- with a symlink -- would provoke the bogus
        ELOOP failure.
        * tests/rm/fail-eacces: Add a test for the above.
        * src/c99-to-c89.diff: Adjust offsets.




reply via email to

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