bug-fileutils
[Top][All Lists]
Advanced

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

rm anomaly on symlinks with fileutils 4.1.9


From: Jonas Pasche
Subject: rm anomaly on symlinks with fileutils 4.1.9
Date: 08 Jan 2003 16:05:55 +0100

Hi there,

I recently discovered a change in the behaviour of "rm" regarding
symbolic links when comparing Red Hat Linux 7.2 (fileutils 4.1) and Red
Hat Linux 8.0 (fileutils 4.1.9) which I cannot explain. I'd be happy if
anybody could explain that behaviour, or if this can be alternatively
filed as a bug. I saw that 4.1.9 is from alpha.gnu.org; is Red Hat just
too bleeding edge again here..?

Here is what happens with fileutils 4.1 on Red Hat 7.2:

# mkdir testdir1
# ln -s testdir1 testdir2

  Case A:

    # rm -i testdir2
    rm: remove `testdir2'? y
    (Symlink removed)

  Case B:

    # rm -i testdir2/
    rm: remove `testdir2'? y
    (Symlink removed)

So there obviously is no difference between "testdir2" and "testdir2/".

Now the same with fileutils 4.1.9 on Red Hat 8.0:

# mkdir testdir1
# ln -s testdir1 testdir2

  Case A:

    # rm -i testdir2
    rm: remove symbolic link `testdir2'? y
    (Symlink removed)

  Case B:

    # rm testdir2/
    rm: remove directory `testdir2/'? y
    rm: cannot remove directory `testdir2/': Not a directory
    (Symlink not removed)

So suddenly "testdir2" is seen as a directory instead of a symlink if
you put a "/" behind it (which automatically happens if you use the TAB
key).

Let's go a bit further (still being on Red Hat 8.0):

# mkdir testdir1
# touch testdir1/testfile
# ln -s testdir1 testdir2

Now deleting:

# rm -i testdir2/
rm: remove directory `testdir2/'? y
rm: remove regular empty file `testdir2//testfile'? y
rm: remove directory `testdir2/'? y
rm: cannot remove directory `testdir2/': Not a directory
(testfile removed)

More brutal, more surprising:

# rm -rf testdir2/
rm: cannot remove `testdir2/': Not a directory
(testfile NOT removed!)

So, using "rm -i" and always say "yes, do it" does NOT produce the same
results as "rm -rf", which doesn't delete anything, even not the symlink
itself. Isn't that confusing?

Any explanations are appreciated.

Jonas

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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