GNU bug report logs - #16669
rm: inconsistent 'rm -ir' prompting behavior (POSIX issue)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Eric Blake <eblake@HIDDEN>; Keywords: confirmed; dated Thu, 6 Feb 2014 16:40:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'rm: inconsistent 'rm -ir' prompting behavior (POSIX issue)' from 'inconsistent 'rm -ir' prompting behavior' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) confirmed. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 16669 <at> debbugs.gnu.org:


Received: (at 16669) by debbugs.gnu.org; 21 Oct 2018 00:08:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 20 20:08:31 2018
Received: from localhost ([127.0.0.1]:33633 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gE1IF-0005y6-7u
	for submit <at> debbugs.gnu.org; Sat, 20 Oct 2018 20:08:31 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:53180)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1gE1IE-0005xu-4J
 for 16669 <at> debbugs.gnu.org; Sat, 20 Oct 2018 20:08:30 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id A877016005D;
 Sat, 20 Oct 2018 17:08:24 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id krLfds-svggj; Sat, 20 Oct 2018 17:08:23 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id B0BAA160061;
 Sat, 20 Oct 2018 17:08:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 6AavfP4f1pj9; Sat, 20 Oct 2018 17:08:23 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 76B1C16005D;
 Sat, 20 Oct 2018 17:08:23 -0700 (PDT)
Subject: Re: bug#16669: inconsistent 'rm -ir' prompting behavior
To: Assaf Gordon <assafgordon@HIDDEN>, =?UTF-8?Q?P=c3=a1draig_Brady?=
 <P@HIDDEN>, Eric Blake <eblake@HIDDEN>
References: <52F3BAAE.9060107@HIDDEN> <52F3C9EB.5060803@HIDDEN>
 <041aa06d-a564-8080-e06f-52adc8180143@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <38cf4fba-173c-2e9e-79c4-96918ec9f4d4@HIDDEN>
Date: Sat, 20 Oct 2018 17:08:23 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.2.1
MIME-Version: 1.0
In-Reply-To: <041aa06d-a564-8080-e06f-52adc8180143@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 16669
Cc: 16669 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Assaf Gordon wrote:
> Was there ever a resolution (or a committed fix)
> for the "rm -ir" issue in:
> https://bugs.gnu.org/16669

Not yet. I'd leave the bug open.




Information forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.

Message received at 16669 <at> debbugs.gnu.org:


Received: (at 16669) by debbugs.gnu.org; 19 Oct 2018 23:34:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 19 19:34:19 2018
Received: from localhost ([127.0.0.1]:60006 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDeHb-0000wK-Jh
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 19:34:19 -0400
Received: from mail-pf1-f172.google.com ([209.85.210.172]:42098)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>) id 1gDeHa-0000w4-0H
 for 16669 <at> debbugs.gnu.org; Fri, 19 Oct 2018 19:34:18 -0400
Received: by mail-pf1-f172.google.com with SMTP id f26-v6so17125312pfn.9
 for <16669 <at> debbugs.gnu.org>; Fri, 19 Oct 2018 16:34:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=qD9NcqMwpUppRTEHkbVtN5789ok/5LuQZsAwNMiIbdk=;
 b=hpmo/ErSh/YSaosoCF/W6oAR6k6JOP+J9r/woB2KP/uCqf7sled6rF6ekfXPT9ZQLm
 H/qM0qL4D2G+6r0M8MEuFyA3fMbPhszq4kpvw5JxIzpv6Zhm4XIuaczGI11R6GiCukJn
 i3GZYFf+CeCAnuv9FwCsnHCt8fi7U1yfvpIDDrF/PX1ZWeljdVQKYPHcOAT0lU5DDDig
 7IPyOux+K8IkOhqPzahyl25XyFwTNd8IWfH90UEv2dZE/1IKO6Wamp0s0pg0JhfIJAUp
 ZZiZ7l4fMxbdBwStF0P5NjCVp+WsJONA2QsT62vdvYcJE75K/gzEq5rQoVbLl8DbPrR0
 zE8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=qD9NcqMwpUppRTEHkbVtN5789ok/5LuQZsAwNMiIbdk=;
 b=VqaqqeAow1te+oauz9JxG0C8PtTpbfgOEnDtGiwISTgRAs5+UfFYlomTOk480gXmon
 eV0gi2kIQmtypC7tDTzcLvomhjCFB2EBcgilc662QCiHD02yJks72ag55kbbOwWJkVI3
 ssV361Wrva3NX2cmPeGbsl2DaN36XlAZA2rwli3bbsSInoLLffVwbVIsIW0SAkiHHKMu
 7IPeXAzf4H5BmVfDPL+Ee/nFpKjejWamJlYAD8NLP2H2GYboxmAKjeQOAOOmqnfRqdkc
 g6B+Uj5Z3zBASIigI9FEygo0ndY69SxO69uXLpYvOsO2yjsg1oS0R558InyREuN+YtG8
 L79w==
X-Gm-Message-State: ABuFfogVFjO6CwHDgQU2+r/+Y05PqwdX9gy5KNDSghU3Yb7zI67suxjv
 SeQjw45/z398+XdJ8iZQ8sVhQX7WWjE=
X-Google-Smtp-Source: ACcGV63beeLtZ4Yt4na9ZBfK1oMGZZrE8UIfda3hP0oGNSQYl/+mezTMNT+cXHPFNfKmcSJpDaC11w==
X-Received: by 2002:a62:be1a:: with SMTP id
 l26-v6mr37312859pff.204.1539992051566; 
 Fri, 19 Oct 2018 16:34:11 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 v33-v6sm22799800pgn.57.2018.10.19.16.34.09
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Oct 2018 16:34:09 -0700 (PDT)
Subject: Re: bug#16669: inconsistent 'rm -ir' prompting behavior
To: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@HIDDEN>,
 Eric Blake <eblake@HIDDEN>
References: <52F3BAAE.9060107@HIDDEN> <52F3C9EB.5060803@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <041aa06d-a564-8080-e06f-52adc8180143@HIDDEN>
Date: Fri, 19 Oct 2018 17:34:08 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <52F3C9EB.5060803@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 16669
Cc: 16669 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

(triaging old bugs)

Eric, Pádraig,

On 06/02/14 10:44 AM, Pádraig Brady wrote:
> On 02/06/2014 04:39 PM, Eric Blake wrote:
>> On today's Austin Group call, we discussed
>> http://austingroupbugs.net/view.php?id=802 regarding 'rm' behavior.
>>

Was there ever a resolution (or a committed fix)
for the "rm -ir" issue in:
   https://bugs.gnu.org/16669


-assaf





Information forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.

Message received at 16669 <at> debbugs.gnu.org:


Received: (at 16669) by debbugs.gnu.org; 6 Feb 2014 17:44:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 12:44:17 2014
Received: from localhost ([127.0.0.1]:53636 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WBSzp-0003b2-89
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:44:17 -0500
Received: from mail5.vodafone.ie ([213.233.128.176]:19861)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1WBSzm-0003aq-0m
 for 16669 <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:44:14 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApQBAK7J81Jda8mX/2dsb2JhbAANMhqDRINYu3CBIoMZAQEBAwEjDwFGBQsLDQEKAgIFFgsCAgkDAgECAUUGDQEHAQGHeQ0INqsXdqB4F4EpjVEHgm+BSQSZXYU+jl4
Received: from unknown (HELO [192.168.1.79]) ([93.107.201.151])
 by mail3.vodafone.ie with ESMTP; 06 Feb 2014 17:44:12 +0000
Message-ID: <52F3C9EB.5060803@HIDDEN>
Date: Thu, 06 Feb 2014 17:44:11 +0000
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#16669: inconsistent 'rm -ir' prompting behavior
References: <52F3BAAE.9060107@HIDDEN>
In-Reply-To: <52F3BAAE.9060107@HIDDEN>
X-Enigmail-Version: 1.6
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 16669
Cc: 16669 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 02/06/2014 04:39 PM, Eric Blake wrote:
> On today's Austin Group call, we discussed
> http://austingroupbugs.net/view.php?id=802 regarding 'rm' behavior.
> 
> They pointed out that GNU has an optimization not allowed by a strict
> reading of the current standard:
> 
> $ mkdir foo
> $ rm -ir foo
> rm: remove directory ‘foo’?
> 
> Whether you answer yes or no, the point remains: rm only prompted once
> about removing the empty directory

[snip]

> Conversely, consider:
> 
> $ rm -ir foo
> rm: descend into directory ‘foo’? y
> rm: remove regular empty file ‘foo/bar’? n
> rm: remove directory ‘foo’? y
> rm: cannot remove ‘foo’: Directory not empty
> 
> Why on earth are we prompting to remove 'foo' when we KNOW it is
> non-empty because the user specifically asked to not remove foo/bar?  If
> we can optimize from two prompts down to one for the empty directory
> case, why are we not optimizing and avoiding asking a useless prompt for
> a known non-empty directory?

The different handling could be useful I think.

When we determine there are no files in a dir,
then only one prompt is necessary.

If we determine files are present a separate prompt
is useful to cater for the following sequence
in terminal 1 and terminal 2.

1> $ rm -ir foo
1> rm: descend into directory ‘foo’? y
1> rm: remove regular empty file ‘foo/bar’? n
1> rm: remove directory ‘foo’?

2> mv foo/bar /safe/foo  # Handle this unknown file _independently_

1> y

thanks,
Pádraig.




Information forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.

Message received at 16669 <at> debbugs.gnu.org:


Received: (at 16669) by debbugs.gnu.org; 6 Feb 2014 17:33:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 12:33:47 2014
Received: from localhost ([127.0.0.1]:53631 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WBSpf-0003Iv-6G
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:33:47 -0500
Received: from mx1.redhat.com ([209.132.183.28]:29430)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1WBSpc-0003Ik-PZ
 for 16669 <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:33:46 -0500
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
 (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s16HXaFF021303
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Thu, 6 Feb 2014 12:33:36 -0500
Received: from [10.3.113.39] (ovpn-113-39.phx2.redhat.com [10.3.113.39])
 by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 s16HXZev005295; Thu, 6 Feb 2014 12:33:35 -0500
Message-ID: <52F3C76F.9070301@HIDDEN>
Date: Thu, 06 Feb 2014 10:33:35 -0700
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version: 1.0
To: Paul Eggert <eggert@HIDDEN>, 16669 <at> debbugs.gnu.org
Subject: Re: bug#16669: inconsistent 'rm -ir' prompting behavior
References: <52F3BAAE.9060107@HIDDEN> <52F3C076.3080105@HIDDEN>
In-Reply-To: <52F3C076.3080105@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="Rp0Ltjnk1f1Jbw4hFlPB2NGDjtvixlO6O"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
X-Spam-Score: -5.5 (-----)
X-Debbugs-Envelope-To: 16669
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.5 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Rp0Ltjnk1f1Jbw4hFlPB2NGDjtvixlO6O
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 02/06/2014 10:03 AM, Paul Eggert wrote:
> On 02/06/2014 08:39 AM, Eric Blake wrote:
>> should I also allow for an optimization of omitting the second prompt
>> for a known non-empty directory
>=20
> I would, yes.  Thanks for catching that.
>=20
>> (known because of a negative answer to
>> prompts on its children)
> It might also be known because of a failed attempt to remove a child,
> and this optimization should be allowed as well.

http://austingroupbugs.net/view.php?id=3D819 was created to attempt this,=

although it may need another round of word-smithing to make sure it is
correct for what we want.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--Rp0Ltjnk1f1Jbw4hFlPB2NGDjtvixlO6O
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJS88dvAAoJEKeha0olJ0NqqRQH/0e5xhxpjbsXUj71VARmFllp
3dzD4j55jcYR7cg0EKi9ehwKqX5F0o2J9cUgdg33KrA1fmtt6Ik8y0uOoFIu/yHM
QiceW3Gkgah964yht5HVuY7n0hYnfunk+erS62dibaSAHmhHmJSsSW0EhSGYHPMi
8deVq0b8kP6y/Nphe04zs4qTJ5NjJJoTQOyJ5F0De7LcZe/bgouQasL1gg+RuizG
LEKvwnHS2uxNzMAT4hWoOkZpk7HcpLTd1980c0J1KX5rdVOUvz3MLBpNc3/AzeVf
lKvZyNbis55JwnloPT2B72NUAftUMfHxc9x3lqawv/ySCeYBZtDdUMbldBjeSP0=
=upan
-----END PGP SIGNATURE-----

--Rp0Ltjnk1f1Jbw4hFlPB2NGDjtvixlO6O--




Information forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.

Message received at 16669 <at> debbugs.gnu.org:


Received: (at 16669) by debbugs.gnu.org; 6 Feb 2014 17:04:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 12:04:00 2014
Received: from localhost ([127.0.0.1]:53591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WBSMp-0000Du-It
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:04:00 -0500
Received: from smtp.cs.ucla.edu ([131.179.128.62]:42445)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eggert@HIDDEN>) id 1WBSMm-0000Dl-8o
 for 16669 <at> debbugs.gnu.org; Thu, 06 Feb 2014 12:03:57 -0500
Received: from localhost (localhost.localdomain [127.0.0.1])
 by smtp.cs.ucla.edu (Postfix) with ESMTP id 04C2EA60001;
 Thu,  6 Feb 2014 09:03:55 -0800 (PST)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
 by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id AgOxn-ylfv7o; Thu,  6 Feb 2014 09:03:54 -0800 (PST)
Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200])
 by smtp.cs.ucla.edu (Postfix) with ESMTPSA id A9A9239E8017;
 Thu,  6 Feb 2014 09:03:54 -0800 (PST)
Message-ID: <52F3C076.3080105@HIDDEN>
Date: Thu, 06 Feb 2014 09:03:50 -0800
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>, 16669 <at> debbugs.gnu.org
Subject: Re: bug#16669: inconsistent 'rm -ir' prompting behavior
References: <52F3BAAE.9060107@HIDDEN>
In-Reply-To: <52F3BAAE.9060107@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.8 (--)
X-Debbugs-Envelope-To: 16669
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.8 (--)

On 02/06/2014 08:39 AM, Eric Blake wrote:
> should I also allow for an optimization of omitting the second prompt
> for a known non-empty directory

I would, yes.  Thanks for catching that.

> (known because of a negative answer to
> prompts on its children)
It might also be known because of a failed attempt to remove a child, 
and this optimization should be allowed as well.




Information forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Feb 2014 16:39:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 06 11:39:33 2014
Received: from localhost ([127.0.0.1]:53575 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WBRzA-0007yK-FY
	for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 11:39:33 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34425)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1WBRz6-0007y8-KD
 for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 11:39:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1WBRz1-0007p3-Ga
 for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 11:39:28 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:55899)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1WBRz1-0007oz-ED
 for submit <at> debbugs.gnu.org; Thu, 06 Feb 2014 11:39:23 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36091)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1WBRyw-0006hk-PO
 for bug-coreutils@HIDDEN; Thu, 06 Feb 2014 11:39:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1WBRys-0007mo-9d
 for bug-coreutils@HIDDEN; Thu, 06 Feb 2014 11:39:18 -0500
Received: from mx1.redhat.com ([209.132.183.28]:15597)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1WBRys-0007mC-1U
 for bug-coreutils@HIDDEN; Thu, 06 Feb 2014 11:39:14 -0500
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s16GdB37029554
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <bug-coreutils@HIDDEN>; Thu, 6 Feb 2014 11:39:12 -0500
Received: from [10.3.113.39] (ovpn-113-39.phx2.redhat.com [10.3.113.39])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s16GdAOw020321
 for <bug-coreutils@HIDDEN>; Thu, 6 Feb 2014 11:39:11 -0500
Message-ID: <52F3BAAE.9060107@HIDDEN>
Date: Thu, 06 Feb 2014 09:39:10 -0700
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: inconsistent 'rm -ir' prompting behavior
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="Qk8SVxWqh6ir0Wk1EPL3OklsmClb3gc9L"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Qk8SVxWqh6ir0Wk1EPL3OklsmClb3gc9L
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On today's Austin Group call, we discussed
http://austingroupbugs.net/view.php?id=3D802 regarding 'rm' behavior.

They pointed out that GNU has an optimization not allowed by a strict
reading of the current standard:

$ mkdir foo
$ rm -ir foo
rm: remove directory =E2=80=98foo=E2=80=99?

Whether you answer yes or no, the point remains: rm only prompted once
about removing the empty directory.  Compare that to other
implementations, such as Solaris:

$ rm -ir /tmp/foo
rm: examine files in directory /tmp/foo (yes/no)? y
rm: remove /tmp/foo (yes/no)? y
$

Note that the optimization implies that we did a readdir() on the
directory before deciding whether to prompt, in order to learn if it was
empty; and that readdir() modifies directory atime; in the Solaris
implementation, readdir() is not even attempted until after a positive
prompt response, which means directory atime is unchanged if the user
chooses not to descend.

Meanwhile, for a non-empty directory, we DO prompt twice for the director=
y:

$ touch foo/bar
$ rm -ir foo
rm: descend into directory =E2=80=98foo=E2=80=99? y
rm: remove regular empty file =E2=80=98foo/bar=E2=80=99? y
rm: remove directory =E2=80=98foo=E2=80=99?

Here, we get the POSIX-mandated double prompting, once to descend, and
once after recursion is complete to see whether to remove the now-empty
directory.  The argument is whether the GNU optimization of prompting
only once for an empty directory violates POSIX (and where it is
observable by a new directory atime), or whether we should patch POSIX
to allow the GNU optimization.  In the meeting, I ended up with an
action item to right the bug report against POSIX to propose wording
that would allow the GNU behavior.

Conversely, consider:

$ rm -ir foo
rm: descend into directory =E2=80=98foo=E2=80=99? y
rm: remove regular empty file =E2=80=98foo/bar=E2=80=99? n
rm: remove directory =E2=80=98foo=E2=80=99? y
rm: cannot remove =E2=80=98foo=E2=80=99: Directory not empty

Why on earth are we prompting to remove 'foo' when we KNOW it is
non-empty because the user specifically asked to not remove foo/bar?  If
we can optimize from two prompts down to one for the empty directory
case, why are we not optimizing and avoiding asking a useless prompt for
a known non-empty directory?  So, while writing my POSIX bug report,
should I also allow for an optimization of omitting the second prompt
for a known non-empty directory (known because of a negative answer to
prompts on its children), even though GNU does not yet implement that
optimization?

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--Qk8SVxWqh6ir0Wk1EPL3OklsmClb3gc9L
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJS87quAAoJEKeha0olJ0NqL+wH/iZpJwMVYNm0gQAAaminC89T
GT8oQj3+OK90L933lei/2XSuoR+8oGhFvkk3/uoYiqRY0oTlavvUelRMcI/uv0V2
10+hFmyJSYQDZ7VS0BKrVYVSqyHTZI1xGDuzVBn4gYFtPFwRwVqbFStoKI4iOU1a
Zh2jNOPOcpbMMTeP61b2DaSdWAQSCfJf9aOnixsr7c+kyFE9FWjmKbrNPZp2fTOj
ff36Bfw/WW3dqq8khX1qgMzzwISj0NKYeiBX9Ll8K9JvM8q+Wvm2gYaZWLhKze0n
VhgeYvJYe4QpZO9FgQiLc4ijDccUdEfW3NmBJqBnUZpTRxURG97TZkHK29+GK2U=
=7wcC
-----END PGP SIGNATURE-----

--Qk8SVxWqh6ir0Wk1EPL3OklsmClb3gc9L--




Acknowledgement sent to Eric Blake <eblake@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#16669; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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