rm anomaly on symlinks with fileutils 4.1.9
Jonas Pasche <[email protected]>
| Newsgroups | gmane.comp.gnu.fileutils.bugs |
|---|---|
| Message-ID | <1042038355.1605.357.camel@leonardo> |
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
_______________________________________________
Bug-fileutils mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-fileutils
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA+HD5TrQcZ9Dgzi4MRAg7AAJ0UylbW9+TWkufy8FfHtJR9W+VLYwCfW4n2 W8SBE7RWgoFVxuIRJWCOFfA= =aJuF -----END PGP SIGNATURE-----