From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 15 20:05:07 2011 Received: (at submit) by debbugs.gnu.org; 16 Aug 2011 00:05:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qt79V-00008X-Ur for submit@debbugs.gnu.org; Mon, 15 Aug 2011 20:05:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qt6f8-0007rS-8G for submit@debbugs.gnu.org; Mon, 15 Aug 2011 19:33:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qt6dQ-00058k-KK for submit@debbugs.gnu.org; Mon, 15 Aug 2011 19:31:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:55251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qt6dQ-00058g-It for submit@debbugs.gnu.org; Mon, 15 Aug 2011 19:31:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qt6dP-0004YA-DH for bug-coreutils@gnu.org; Mon, 15 Aug 2011 19:31:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qt6dO-00058S-5K for bug-coreutils@gnu.org; Mon, 15 Aug 2011 19:31:55 -0400 Received: from the-rift.de ([85.214.100.4]:53865 helo=h1370973.stratoserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qt6dN-0004qn-SA for bug-coreutils@gnu.org; Mon, 15 Aug 2011 19:31:54 -0400 Received: (qmail 21570 invoked from network); 16 Aug 2011 01:31:29 +0200 Received: from p57aa6d1f.dip.t-dialin.net (HELO ?192.168.2.30?) (87.170.109.31) by the-rift.de with (DHE-RSA-AES256-SHA encrypted) SMTP; 16 Aug 2011 01:31:29 +0200 Message-ID: <4E49AC3A.9000802@phrozenbyte.de> Date: Tue, 16 Aug 2011 01:31:06 +0200 From: Daniel Rudolf User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110628 Thunderbird/5.0 MIME-Version: 1.0 To: bug-coreutils@gnu.org Subject: rm -I vs. rm --interactive=once X-Enigmail-Version: 1.2pre Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 15 Aug 2011 20:05:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: drudolf@phrozenbyte.de List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) 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 . 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 23 17:56:54 2013 Received: (at 9308) by debbugs.gnu.org; 23 Sep 2013 21:56:55 +0000 Received: from localhost ([127.0.0.1]:59121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOE7h-0008Vb-SL for submit@debbugs.gnu.org; Mon, 23 Sep 2013 17:56:54 -0400 Received: from kwanyin.sergiodj.net ([142.4.206.232]:39462) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VNwxb-0004dN-NH for 9308@debbugs.gnu.org; Sun, 22 Sep 2013 23:37:20 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (envelope-from ) id 1VNwwK-00083g-UY for 9308@debbugs.gnu.org; Sun, 22 Sep 2013 23:36:01 -0400 From: Sergio Durigan Junior To: 9308@debbugs.gnu.org Subject: [PATCH] Proposed fix X-URL: http://sergiodj.net/blog Date: Mon, 23 Sep 2013 00:37:10 -0300 Message-ID: <87r4cgp5sp.fsf@sergiodj.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 9308 X-Mailman-Approved-At: Mon, 23 Sep 2013 17:56:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 * 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; From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 25 06:55:44 2013 Received: (at 9308-done) by debbugs.gnu.org; 25 Sep 2013 10:55:44 +0000 Received: from localhost ([127.0.0.1]:34593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOmkx-0003cw-OL for submit@debbugs.gnu.org; Wed, 25 Sep 2013 06:55:44 -0400 Received: from mail1.vodafone.ie ([213.233.128.43]:43363) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOmks-0003ci-26 for 9308-done@debbugs.gnu.org; Wed, 25 Sep 2013 06:55:39 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsBAJjAQlJtTn0Q/2dsb2JhbAANToM/TIkMtz+BNIMZAQEBBHkQCw0EAwECAQklDwI+CAYNAQUCAQEWh3OoUZMwj0ARBwmEFAOQJokFhSqFbohV Received: from unknown (HELO [192.168.1.79]) ([109.78.125.16]) by mail1.vodafone.ie with ESMTP; 25 Sep 2013 11:55:36 +0100 Message-ID: <5242C124.20000@draigBrady.com> Date: Wed, 25 Sep 2013 11:55:32 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Sergio Durigan Junior Subject: Re: bug#9308: [PATCH] Proposed fix References: <4E49AC3A.9000802@phrozenbyte.de> <87r4cgp5sp.fsf@sergiodj.net> In-Reply-To: <87r4cgp5sp.fsf@sergiodj.net> X-Enigmail-Version: 1.5.2 Content-Type: multipart/mixed; boundary="------------050401010705040503050803" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9308-done Cc: 9308-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) This is a multi-part message in MIME format. --------------050401010705040503050803 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit 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. --------------050401010705040503050803 Content-Type: text/x-patch; name="rm-I.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rm-I.patch" >From ee2b057e9eddbfedbfca9486f8b4d3002bcd7a3d Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Wed, 25 Sep 2013 11:02:08 +0100 Subject: [PATCH] rm: with -I, prompt when deleting write protected files This regression was introduced in commit v6.7-71-g0928c24 * src/rm.c (main): Make the -I option the same as --interactive=once. * tests/rm/interactive-once.sh: Add cases for single and multiple files. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/9308 --- NEWS | 3 +++ src/rm.c | 2 +- tests/rm/interactive-once.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletions(-) diff --git a/NEWS b/NEWS index c152bbf..861ca37 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,9 @@ GNU coreutils NEWS -*- outline -*- print approximately 2*N bytes of extraneous padding. [Bug introduced in coreutils-7.0] + rm -I will prompt for confirmation when removing write protected files. + [Bug introduced in coreutils-6.8] + tail --retry -f now waits for the files specified to appear. Before, tail would immediately exit when such a file is inaccessible during the initial open. 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; diff --git a/tests/rm/interactive-once.sh b/tests/rm/interactive-once.sh index dcda5b8..1064c08 100755 --- a/tests/rm/interactive-once.sh +++ b/tests/rm/interactive-once.sh @@ -35,6 +35,15 @@ rm -I file1-* < in-n >> out 2>> err || fail=1 echo . >> err || fail=1 test -f file1-1 && fail=1 +if ls /dev/stdin >/dev/null 2>&1; then + echo 'one file, read only, answer no' >> err || fail=1 + touch file1-1 || framework_failure_ + chmod a-w file1-1 || framework_failure_ + rm ---presume-input-tty -I file1-* < in-n >> out 2>> err || fail=1 + echo . >> err || fail=1 + test -f file1-1 || fail=1 +fi + echo 'three files, no recursion' >> err || fail=1 rm -I file2-* < in-n >> out 2>> err || fail=1 echo . >> err || fail=1 @@ -58,6 +67,19 @@ test -f file3-2 && fail=1 test -f file3-3 && fail=1 test -f file3-4 && fail=1 +if ls /dev/stdin >/dev/null 2>&1; then + echo 'four files, no recursion, 1 read only, answer yes no' >> err || fail=1 + touch file3-1 file3-2 file3-3 file3-4 || framework_failure_ + echo non_empty > file3-4 || framework_failure_ # to shorten diagnostic + chmod a-w file3-4 || framework_failure_ + cat in-y in-n | rm ---presume-input-tty -I file3-* >> out 2>> err || fail=1 + echo . >> err || fail=1 + test -f file3-1 && fail=1 + test -f file3-2 && fail=1 + test -f file3-3 && fail=1 + test -f file3-4 || fail=1 +fi + echo 'one file, recursion, answer no' >> err || fail=1 rm -I -R dir1-* < in-n >> out 2>> err || fail=1 echo . >> err || fail=1 @@ -85,12 +107,16 @@ EOF cat <<\EOF > experr || fail=1 one file, no recursion . +one file, read only, answer no +rm: remove write-protected regular empty file 'file1-1'? . three files, no recursion . four files, no recursion, answer no rm: remove 4 arguments? . four files, no recursion, answer yes rm: remove 4 arguments? . +four files, no recursion, 1 read only, answer yes no +rm: remove 4 arguments? rm: remove write-protected regular file 'file3-4'? . one file, recursion, answer no rm: remove 1 argument recursively? . one file, recursion, answer yes -- 1.7.7.6 --------------050401010705040503050803-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 26 00:28:15 2013 Received: (at 9308) by debbugs.gnu.org; 26 Sep 2013 04:28:15 +0000 Received: from localhost ([127.0.0.1]:36699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VP3BW-0006WC-Ek for submit@debbugs.gnu.org; Thu, 26 Sep 2013 00:28:15 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:60701) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VP3BT-0006Vw-3t; Thu, 26 Sep 2013 00:28:11 -0400 Received: by mail-pb0-f43.google.com with SMTP id md4so585549pbc.2 for ; Wed, 25 Sep 2013 21:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=BJ0/w+sWIblKReL0ElVbEyXb7fZ16OckGpwVxygxS98=; b=UJtH/8GBxpibxexwmsRCEtIRG5edpwZmE+/IjM4PInYJMCzqWLShO62snnN7/8KgDM ZFyY1hy02eMDlZyBzPXpLDkqp+ASeBPIlc1nIhStmXl6CjREXtRzN5fxHiid+LzxJF8g AAawLqr+LwgLwXUK/StPBMHAxd9J7wNAeSwYzcGjOKEAcpGTMbkMl+6D52nSbJYl+mMF qdC+M2dGkuXu1PvP9LNugWR2JMjl8HLo43mo/u5614aSR6fScnnZSIOY+7yumyBETVSM Pt7k3CUwMNdjquoTRk9y+PIl5sf9RoMzXWY9HUE78NJTl+qDwd1Ri/Db9Vl8zGxi8dyW fQ2Q== X-Received: by 10.66.182.36 with SMTP id eb4mr2805632pac.125.1380169689808; Wed, 25 Sep 2013 21:28:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Wed, 25 Sep 2013 21:27:49 -0700 (PDT) In-Reply-To: <5242C124.20000@draigBrady.com> References: <4E49AC3A.9000802@phrozenbyte.de> <87r4cgp5sp.fsf@sergiodj.net> <5242C124.20000@draigBrady.com> From: Jim Meyering Date: Wed, 25 Sep 2013 21:27:49 -0700 X-Google-Sender-Auth: xHsY-nfJ7-KYotRu2sntmy6fSiY Message-ID: Subject: Re: bug#9308: [PATCH] Proposed fix To: 9308@debbugs.gnu.org, =?ISO-8859-1?Q?P=E1draig_Brady?= , drudolf@phrozenbyte.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 9308 Cc: 9308-done@debbugs.gnu.org, Sergio Durigan Junior X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Wed, Sep 25, 2013 at 3:55 AM, P=E1draig Brady 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 fil= e. Thanks especially for adding those tests. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 26 06:31:56 2013 Received: (at 9308) by debbugs.gnu.org; 26 Sep 2013 10:31:56 +0000 Received: from localhost ([127.0.0.1]:37193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VP8rT-0001hV-9v for submit@debbugs.gnu.org; Thu, 26 Sep 2013 06:31:55 -0400 Received: from mail1.vodafone.ie ([213.233.128.43]:50398) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VP8rR-0001hJ-0a for 9308@debbugs.gnu.org; Thu, 26 Sep 2013 06:31:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAAIMRFJtTjSj/2dsb2JhbAANTsRjgTiDGQEBAQQyAUYQCw0LCRYPCQMCAQIBRQYNAQUCAQEWsQGTQ49RB4QeA55WjkQ Received: from unknown (HELO [192.168.1.79]) ([109.78.52.163]) by mail1.vodafone.ie with ESMTP; 26 Sep 2013 11:31:51 +0100 Message-ID: <52440D13.4010304@draigBrady.com> Date: Thu, 26 Sep 2013 11:31:47 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#9308: [PATCH] Proposed fix References: <4E49AC3A.9000802@phrozenbyte.de> <87r4cgp5sp.fsf@sergiodj.net> <5242C124.20000@draigBrady.com> In-Reply-To: X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9308 Cc: Sergio Durigan Junior , drudolf@phrozenbyte.de, 9308@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 09/26/2013 05:27 AM, Jim Meyering wrote: > On Wed, Sep 25, 2013 at 3:55 AM, Pádraig Brady 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. From unknown Mon Jun 23 02:22:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 24 Oct 2013 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator