GNU bug report logs -
#45700
rm should not prompt if ! isatty(2)
Previous Next
Reported by: John Wiersba <jrw32982 <at> yahoo.com>
Date: Wed, 6 Jan 2021 18:57:01 UTC
Severity: normal
Tags: notabug
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 1/6/21 10:56 AM, John Wiersba via GNU coreutils Bug Reports wrote:
> $ touch asdf && chmod a-w asdf && rm asdf 2>&1 | catrm: remove write-protected regular empty file 'asdf'? # should*not* prompt
>
> If the prompt cannot be seen, then it can't be properly answered, so there is no point in prompting and consequently leaving the user with a hanging command and no way to know what's being expected of them. Instead rm should attempt to remove the file and succeed or fail based on the result.
POSIX requires the current behavior; see clause 3 in:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html
Although GNU rm needn't follow POSIX blindly, it's doubtful that rm
should remove the file in this particular case, as the longstanding
tradition is that plain "rm" does not remove unwriteable files without
more confirmation.
Since you know about "rm -f" I suggest using that (that's what everyone
else does...).
This bug report was last modified 3 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.