bug-coreutils
[Top][All Lists]
Advanced

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

bug#45700: rm should not prompt if ! isatty(2)


From: Paul Eggert
Subject: bug#45700: rm should not prompt if ! isatty(2)
Date: Wed, 6 Jan 2021 11:16:57 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

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...).





reply via email to

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