Mike Castle <[EMAIL PROTECTED]> wrote:
> Not sure if this is a bug or feature (or even Linux specific).
>
> nexus@thune[3:30pm]~(937) ls foo bar
> ls: foo: No such file or directory
> ls: bar: No such file or directory
> nexus@thune[3:31pm]~(938) ln -s foo bar
> nexus@thune[3:31pm]~(939) rm bar
> rm: remove symbolic link `bar'? y
> nexus@thune[3:31pm]~(940) ln -s foo bar
> nexus@thune[3:31pm]~(941) rm -f bar
> nexus@thune[3:31pm]~(942) rm --version
> rm (fileutils) 4.1.9
> nexus@thune[3:31pm]~(943) touch foo
> nexus@thune[3:32pm]~(946) ln -s foo bar
> nexus@thune[3:32pm]~(947) rm bar
>
> In the dangling symlink case, should it be prompting about removal?
Thanks a lot for the report!
It's a bug.
Here's a fix:
* src/remove.c (prompt): Fix test for write-protectedness to also
check errno == EACCES. Otherwise, `rm dangling-symlink' would
mistakenly prompt. Reported by Mike Castle.
* tests/rm/Makefile.am (TESTS): Add dangling-symlink.
* tests/rm/dangling-symlink: New file/test, for the above fix.
Index: src/remove.c
===================================================================
RCS file: /fetish/fileutils/src/remove.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -p -u -r1.56 -r1.57
--- src/remove.c 29 Jun 2002 11:50:38 -0000 1.56
+++ src/remove.c 4 Jul 2002 12:06:49 -0000 1.57
@@ -560,7 +560,7 @@ prompt (char const *filename, struct rm_
*is_dir = T_UNKNOWN;
if ((!x->ignore_missing_files && (x->interactive || x->stdin_tty)
- && (write_protected = euidaccess (filename, W_OK)))
+ && (write_protected = (euidaccess (filename, W_OK) && errno == EACCES)))
|| x->interactive)
{
struct stat sbuf;
_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils