GNU bug report logs - #9308
rm -I vs. rm --interactive=once

Previous Next

Package: coreutils;

Reported by: drudolf <at> phrozenbyte.de

Date: Tue, 16 Aug 2011 00:06:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9308 in the body.
You can then email your comments to 9308 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9308; Package coreutils. (Tue, 16 Aug 2011 00:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to drudolf <at> phrozenbyte.de:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 16 Aug 2011 00:06:02 GMT) Full text and rfc822 format available.

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

From: Daniel Rudolf <drudolf <at> phrozenbyte.de>
To: bug-coreutils <at> gnu.org
Subject: rm -I vs. rm --interactive=once
Date: Tue, 16 Aug 2011 01:31:06 +0200
Hi,

according to the --help message and the manual of rm, the parameters
"-I" and "--interactive=once" should be absolutely identical. But when
you're deleting an unwritable file with parameter "-I", rm does not
prompt for this file. When you're using "--interactive=once" rm is
prompting.

> $ touch file1 && chmod -w file1
> $ touch file2 && touch file3 && touch file4
> $ ls -l
> insgesamt 0
> -r--r--r-- 1 daniel daniel 0 2011-08-16 00:52 file1
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file2
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file3
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file4
> $ LC_ALL=C rm --interactive=once file1 file2 file3 file4
> rm: remove all arguments? y
> rm: remove write-protected regular empty file `file1'? y
> $
As you can see rm prompts for the unwritable file "file1".

> $ touch file1 && chmod -w file1
> $ touch file2 && touch file3 && touch file4
> $ LC_ALL=C rm -I file1 file2 file3 file4
> rm: remove all arguments? y
> $
Now rm does not prompt for the unwritable file "file1".

This also happens if you're deleting "file1" only.

My system:
$ LC_ALL=C rm --version
rm (GNU coreutils) 7.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04.3 LTS
Release:	10.04
Codename:	lucid
$ uname -a
Linux HP-Pavilion-Ubuntu 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11
08:03:28 UTC 2010 x86_64 GNU/Linux

Greetings,

Daniel Rudolf




Information forwarded to bug-coreutils <at> gnu.org:
bug#9308; Package coreutils. (Mon, 23 Sep 2013 21:57:06 GMT) Full text and rfc822 format available.

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

From: Sergio Durigan Junior <sergiodj <at> sergiodj.net>
To: 9308 <at> debbugs.gnu.org
Subject: [PATCH] Proposed fix
Date: Mon, 23 Sep 2013 00:37:10 -0300
Hi,

This bug is simple enough that it took only a one-liner to fix it.  I
believe it makes sense, because (as correctly pointed out by Daniel),
rm's manpage explicitly mentions that -I and --interactive=once should
be the same.

Tested here, without failures.  I already have commit access to the
GDB/binutils repo, so if you want to just extend my commit rights to
commit to the coreutils, that's fine too.

Thanks,

-- 
Sergio

2013-09-23  Sergio Durigan Junior  <sergiodj <at> sergiodj.net>

	* src/rm.c (main): Option "-I" should be markes as "sometimes
	interactive" (RMI_SOMETIMES).

diff --git a/src/rm.c b/src/rm.c
index 4b87c12..7a51eef 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -244,7 +244,7 @@ main (int argc, char **argv)
           break;
 
         case 'I':
-          x.interactive = RMI_NEVER;
+          x.interactive = RMI_SOMETIMES;
           x.ignore_missing_files = false;
           prompt_once = true;
           break;




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Wed, 25 Sep 2013 10:56:03 GMT) Full text and rfc822 format available.

Notification sent to drudolf <at> phrozenbyte.de:
bug acknowledged by developer. (Wed, 25 Sep 2013 10:56:05 GMT) Full text and rfc822 format available.

Message #13 received at 9308-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Sergio Durigan Junior <sergiodj <at> sergiodj.net>
Cc: 9308-done <at> debbugs.gnu.org
Subject: Re: bug#9308: [PATCH] Proposed fix
Date: Wed, 25 Sep 2013 11:55:32 +0100
[Message part 1 (text/plain, inline)]
On 09/23/2013 04:37 AM, Sergio Durigan Junior wrote:
> Hi,
> 
> This bug is simple enough that it took only a one-liner to fix it.  I
> believe it makes sense, because (as correctly pointed out by Daniel),
> rm's manpage explicitly mentions that -I and --interactive=once should
> be the same.
> 
> Tested here, without failures.  I already have commit access to the
> GDB/binutils repo, so if you want to just extend my commit rights to
> commit to the coreutils, that's fine too.

The change looks correct, thanks.
I've added NEWS, and tests in the attached and will push soon.

thanks,
Pádraig.


[rm-I.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#9308; Package coreutils. (Thu, 26 Sep 2013 04:29:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: 9308 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigbrady.com>, 
 drudolf <at> phrozenbyte.de
Cc: 9308-done <at> debbugs.gnu.org, Sergio Durigan Junior <sergiodj <at> sergiodj.net>
Subject: Re: bug#9308: [PATCH] Proposed fix
Date: Wed, 25 Sep 2013 21:27:49 -0700
On Wed, Sep 25, 2013 at 3:55 AM, Pádraig Brady <P <at> draigbrady.com> wrote:
...
> The change looks correct, thanks.
> I've added NEWS, and tests in the attached and will push soon.

Thanks to both of you.
The complete patch looks fine.
One suggested tweak:

-  rm -I will prompt for confirmation when removing write protected files.
+  rm -I now prompts for confirmation before removing a write protected file.

Thanks especially for adding those tests.




Information forwarded to bug-coreutils <at> gnu.org:
bug#9308; Package coreutils. (Thu, 26 Sep 2013 04:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#9308; Package coreutils. (Thu, 26 Sep 2013 10:32:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Sergio Durigan Junior <sergiodj <at> sergiodj.net>, drudolf <at> phrozenbyte.de,
 9308 <at> debbugs.gnu.org
Subject: Re: bug#9308: [PATCH] Proposed fix
Date: Thu, 26 Sep 2013 11:31:47 +0100
On 09/26/2013 05:27 AM, Jim Meyering wrote:
> On Wed, Sep 25, 2013 at 3:55 AM, Pádraig Brady <P <at> draigbrady.com> wrote:
> ...
>> The change looks correct, thanks.
>> I've added NEWS, and tests in the attached and will push soon.
> 
> Thanks to both of you.
> The complete patch looks fine.
> One suggested tweak:
> 
> -  rm -I will prompt for confirmation when removing write protected files.
> +  rm -I now prompts for confirmation before removing a write protected file.
> 
> Thanks especially for adding those tests.

thanks for the review!

Pushed.






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Oct 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.