GNU bug report logs - #45700
rm should not prompt if ! isatty(2)

Previous Next

Package: coreutils;

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


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Wiersba <jrw32982 <at> yahoo.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: rm should not prompt if ! isatty(2)
Date: Wed, 6 Jan 2021 18:56:02 +0000 (UTC)
[Message part 1 (text/plain, inline)]
$ /bin/rm --version
rm (GNU coreutils) 8.30

$ uname -a
Linux xxx 5.4.0-59-generic #65-Ubuntu SMP Thu Dec 10 12:01:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Linuxmint
Description:    Linux Mint 20
Release:    20
Codename:    ulyana

$ 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.  Same for any other commands (mv, cp) in similar situations.

I know about the options -f and --interactive=never, but they shouldn't be needed in this case.

Thanks!
[Message part 2 (text/html, inline)]

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.