GNU bug report logs - #25817
rm: add option to avoid early exit on "."

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: L A Walsh <coreutils@HIDDEN>; dated Mon, 20 Feb 2017 19:42:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'rm: add option to avoid early exit on "."' from 'Why were Gnu coding standards violated in favor of posix for 'rm -fr .'?: request for reversion of behavior' 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 submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Feb 2017 18:55:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 21 13:55:55 2017
Received: from localhost ([127.0.0.1]:49207 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cgFbP-0008U0-MA
	for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 13:55:55 -0500
Received: from eggs.gnu.org ([208.118.235.92]:46339)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1cgFbO-0008To-Ol
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 13:55:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cgFbI-00071e-LH
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 13:55:49 -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]:36178)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cgFbI-00071a-GV
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 13:55:48 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37307)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cgFbH-0007Qc-9n
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 13:55:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cgFbE-000712-22
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 13:55:47 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:57456
 helo=Ishtar.sc.tlinx.org)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cgFbD-00070d-DZ
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 13:55:43 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 v1LItbeN099991; Tue, 21 Feb 2017 10:55:40 -0800
Message-ID: <58AC8D29.4070909@HIDDEN>
Date: Tue, 21 Feb 2017 10:55:37 -0800
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
 <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
In-Reply-To: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic] [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
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: -5.0 (-----)



Eric Blake wrote:
>  the discussion here is about an early exit
> on an attempt to remove '.', which, contrary to your claim, appears to
> always have been in POSIX as far as I can tell (and even if it has not
> always been in POSIX, the fact that I can quote a 20-year-old document
> that describes current behavior means that any change to a default now
> would be breaking 20 years of what script writers have come to rely on).
---
	My initial post under this subject said that it was a matter
of not following gnu policy -- of not removing a feature just because
posix said to do so.

	I was cited posix as the justification for this change.  
Apparently that was incorrect, as you point out.  My point was
that the behavior/feature was allowed in coreutils and removed with
a justification that posix disallowed it.

	I doubt I can find a commit, but I may be able to find
a version of coreutils where this is the case, but likely, not
quickly.





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

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


Received: (at 25817) by debbugs.gnu.org; 21 Feb 2017 16:55:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 21 11:55:56 2017
Received: from localhost ([127.0.0.1]:49117 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cgDjI-0005en-Bz
	for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 11:55:56 -0500
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44412)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1cgDjG-0005ea-Sq
 for 25817 <at> debbugs.gnu.org; Tue, 21 Feb 2017 11:55:55 -0500
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8A4F816010A;
 Tue, 21 Feb 2017 08:55:48 -0800 (PST)
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 8t98kUGciuxU; Tue, 21 Feb 2017 08:55:47 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id D294816010C;
 Tue, 21 Feb 2017 08:55:47 -0800 (PST)
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 mTTtQ0WiQrhk; Tue, 21 Feb 2017 08:55:47 -0800 (PST)
Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B924216010A;
 Tue, 21 Feb 2017 08:55:47 -0800 (PST)
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
To: Eric Blake <eblake@HIDDEN>, L A Walsh <coreutils@HIDDEN>
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
 <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <35a501db-a409-7d73-04be-04a560205695@HIDDEN>
Date: Tue, 21 Feb 2017 08:55:47 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25817
Cc: 25817 <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: -0.0 (/)

On 02/21/2017 05:42 AM, Eric Blake wrote:
> "If either of the files dot or dot-dot are specified as the basename
> portion of an operand (that is, the final pathname component), rm will
> write a diagnostic message to standard error and do nothing more with
> such operands."

The same wording is in the first version of POSIX that standardized 
'rm', namely IEEE Std 1003.2-1992 section 4.53.2 lines 8384-6. So we are 
looking at 25 years' worth of standardization here.

Going back even further in time, 7th Edition Unix 'rm' was confused in 
this area. Although 'rm -r ..' had the POSIX-specified behavior, 'rm -r 
.' removed all subfiles and then quietly succeeded without removing '.', 
and there were other complications. Presumably this mess is what the 
early-1990 standardizers were trying to avoid.

At any rate I agree that the requested behavior should be enabled only 
via a new option. Regardless of what one thinks 'rm' should do if we 
could redesign it from scratch, there's too much dead weight of history 
here.





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

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


Received: (at submit) by debbugs.gnu.org; 21 Feb 2017 14:08:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 21 09:08:37 2017
Received: from localhost ([127.0.0.1]:48404 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cgB7M-0001cq-QU
	for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 09:08:37 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34319)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1cgB7K-0001cZ-Vt
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 09:08:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgB7E-0000gV-NI
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 09:08:29 -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]:53206)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1cgB7E-0000gL-K0
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 09:08:28 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53478)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgB7A-0002KS-AR
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 09:08:28 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgB75-0000c6-8y
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 09:08:24 -0500
Received: from mx1.redhat.com ([209.132.183.28]:54352)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1cgB75-0000bi-09
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 09:08:19 -0500
Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com
 [10.5.11.28])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 3EA544E02A;
 Tue, 21 Feb 2017 14:08:19 +0000 (UTC)
Received: from [10.10.123.67] (unknown [10.10.123.67])
 by smtp.corp.redhat.com (Postfix) with ESMTP id AB332660FF;
 Tue, 21 Feb 2017 14:08:18 +0000 (UTC)
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
To: L A Walsh <coreutils@HIDDEN>
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
 <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <4dc1c0b5-c4d9-2c76-4a1b-d1c0c1c4b1c1@HIDDEN>
Date: Tue, 21 Feb 2017 08:08:16 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="Em5kp2B7ViNLND9K9vViJC5ND6xGGN8Ls"
X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.38]); Tue, 21 Feb 2017 14:08:19 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
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: -4.1 (----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--Em5kp2B7ViNLND9K9vViJC5ND6xGGN8Ls
Content-Type: multipart/mixed; boundary="vBogrAHQth4aq6PvlNLDGdRsN9twEbeSi";
 protected-headers="v1"
From: Eric Blake <eblake@HIDDEN>
To: L A Walsh <coreutils@HIDDEN>
Cc: bug-coreutils@HIDDEN
Message-ID: <4dc1c0b5-c4d9-2c76-4a1b-d1c0c1c4b1c1@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
 <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
In-Reply-To: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>

--vBogrAHQth4aq6PvlNLDGdRsN9twEbeSi
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 02/21/2017 07:42 AM, Eric Blake wrote:
> On 02/21/2017 02:41 AM, L A Walsh wrote:
>>
>>     Do you really need me to find the older version
>> of 'rm' in your source tree?
>=20
> It wouldn't hurt to point out which commit id changed behavior, if you
> indeed want to call that commit a regression.  Being able to read the
> commit itself, as well as mailing list traffic at the time, will help
> current readers get a more-informed picture of whether such a change wa=
s
> intentional or accidental.

A bit more research shows that:

1) we don't seem to have any tests that cover 'rm -r .' behavior (so
even if we change the code now, we'd first need to add a test; and
without a test, it's entirely possible that a commit in the past altered
behavior without being noticed because of lack of testsuite coverage)

$ git grep 'rm .*r.* \.' tests/rm
$

So a testsuite addition is welcome, and if nothing else, this bug should
not be closed until we have testsuite coverage, whether or not we change
rm itself.

2) the current behavior is due to this code in src/remove.c:rm_fts():

        {
          /* POSIX says:
             If the basename of a command line argument is "." or "..",
             diagnose it and do nothing more with that argument.  */
          if (dot_or_dotdot (last_component (ent->fts_accpath)))

and a git blame easily shows that portion of the function has been in
place since at least commit 4f73ecaf "rm: rewrite to use fts" (Sep 2009,
release 8.0).  Prior to that date, there is no rm_fts(), so the
archaeology gets trickier, but even as far back as ff59218d "New file.
Contains guts of old rm.c." (Jan 1998, release 4.5.1), there is:

static enum RM_status
rm (struct File_spec *fs, int user_specified_name)
{
  mode_t filetype_mode;

  if (user_specified_name)
    {
      char *base =3D base_name (fs->filename);

      if (DOT_OR_DOTDOT (base))
        {
          error (0, 0, _("cannot remove `.' or `..'"));
          return RM_ERROR;
        }
    }

I've already spent too much time on this, and did not go digging through
earlier history of rm.c or reading any changelogs prior to that point.
Please, if you have evidence of a version where GNU rm behaved
differently, you will do yourself a favor by pointing it out to us,
rather than making a vague assertion that we have changed behavior with
nothing to back up your claim.  A little bit of research on your side
will go a long ways to making your report credible.

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


--vBogrAHQth4aq6PvlNLDGdRsN9twEbeSi--

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

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

iQEcBAEBCAAGBQJYrEnQAAoJEKeha0olJ0NqW90H/RZCM4i+YvDZ0LWUCIPiFh4s
lS6JvSW9V3RgM86zagKT27Mtk8wYCFZUzNgcDyg42KHbyM0hCPFUi4HMBpeNcCdg
mJwD+HzGKqSGcidyIJ3KRduARjVIvSOi2V7EXmycn8VV5scbBk5kx71vSjUP2Oay
vQ3ziAlXyYqBqb8sFnqirc6oenoB11yteCHuD6yYewIsxXQxY0ioQN7Uh0LKiSqB
vyDpXkn9nG4ThNDRvGfIGrnQumKOnG1aCNaAWRkqJz911lm5IOC3AIC1CMg9iC4q
LPxaQHza3zxxkk8CFeHvrP7lObN2ImnowjxbV1nG5o3nwk2M7V+3gs7IHfYaoYA=
=voAk
-----END PGP SIGNATURE-----

--Em5kp2B7ViNLND9K9vViJC5ND6xGGN8Ls--




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

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


Received: (at submit) by debbugs.gnu.org; 21 Feb 2017 13:42:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 21 08:42:56 2017
Received: from localhost ([127.0.0.1]:48396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cgAiW-00012O-It
	for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 08:42:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:50602)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1cgAiV-00012C-6w
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 08:42:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgAiO-0005Us-V1
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 08:42:50 -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]:51042)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1cgAiO-0005Uo-R6
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 08:42:48 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41571)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgAiN-0004s2-Db
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 08:42:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eblake@HIDDEN>) id 1cgAiK-0005TY-BI
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 08:42:47 -0500
Received: from mx1.redhat.com ([209.132.183.28]:51002)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1cgAiK-0005Sz-1r
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 08:42:44 -0500
Received: from int-mx09.intmail.prod.int.phx2.redhat.com
 (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id E8DA837F1F;
 Tue, 21 Feb 2017 13:42:43 +0000 (UTC)
Received: from [10.10.123.67] (ovpn-123-67.rdu2.redhat.com [10.10.123.67] (may
 be forged))
 by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 v1LDghJo019067; Tue, 21 Feb 2017 08:42:43 -0500
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
To: L A Walsh <coreutils@HIDDEN>
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
Date: Tue, 21 Feb 2017 07:42:41 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <58ABFD36.9050703@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="efT0PeBhI6sLgP6f1fH66LxasrdeRRKjl"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.29]); Tue, 21 Feb 2017 13:42:44 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
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: -4.1 (----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--efT0PeBhI6sLgP6f1fH66LxasrdeRRKjl
Content-Type: multipart/mixed; boundary="xKEgSEQthV1cCxrRXIO68XA34VbUXoDGn";
 protected-headers="v1"
From: Eric Blake <eblake@HIDDEN>
To: L A Walsh <coreutils@HIDDEN>
Cc: bug-coreutils@HIDDEN
Message-ID: <54fe96cd-332c-1360-9fe1-9e70d52b4771@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
 <58ABFD36.9050703@HIDDEN>
In-Reply-To: <58ABFD36.9050703@HIDDEN>

--xKEgSEQthV1cCxrRXIO68XA34VbUXoDGn
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 02/21/2017 02:41 AM, L A Walsh wrote:
>=20
>     Do you really need me to find the older version
> of 'rm' in your source tree?

It wouldn't hurt to point out which commit id changed behavior, if you
indeed want to call that commit a regression.  Being able to read the
commit itself, as well as mailing list traffic at the time, will help
current readers get a more-informed picture of whether such a change was
intentional or accidental.

>=20
>     you know as well as I do, that the verbiage
> about disallowing all subpaths under '.' wasn't in earlier
> posix versions (say 2001 or before).

So I spent 20 more minutes on this, and researched a bit further: here's
what POSIX 2001 says:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/rm.html

"If either of the files dot or dot-dot are specified as the basename
portion of an operand (that is, the final pathname component), rm shall
write a diagnostic message to standard error and do nothing more with
such operands."

I then went back to SUSv2, published in 1997:

http://pubs.opengroup.org/onlinepubs/007908799/xcu/rm.html

"If either of the files dot or dot-dot are specified as the basename
portion of an operand (that is, the final pathname component), rm will
write a diagnostic message to standard error and do nothing more with
such operands."

You ARE correct that it was POSIX 2008 that introduced the wording "or
if an operand resolves to the root directory" to cover an early exit on
an attempt to remove '/', but the discussion here is about an early exit
on an attempt to remove '.', which, contrary to your claim, appears to
always have been in POSIX as far as I can tell (and even if it has not
always been in POSIX, the fact that I can quote a 20-year-old document
that describes current behavior means that any change to a default now
would be breaking 20 years of what script writers have come to rely on).

I'm all ears if you can point to an even-older standards document worded
differently, but at this point, I don't think you're going to find one.

And I still maintain that a patch that adds a new option to avoid the
early exit on '.' may be acceptable, but that it would have to be a new
option and not the default behavior.  But I'm not bothered enough by the
current situation to be the one to write such a patch.

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


--xKEgSEQthV1cCxrRXIO68XA34VbUXoDGn--

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

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

iQEcBAEBCAAGBQJYrEPRAAoJEKeha0olJ0Nq4u0H/1rhOuPIbJDNCINiQIfQe+p1
Gbn86vKAaVYXMC0TWGPMVjhja4R5i2u0mf+mRsITwNPtiKxiXqNUESyI1qA1OZm0
2v5MrdMLIe5rIasWjRVMR/gFhQVECS3O/i7YF2sPdSwSJxwZg7ZohP9U8Eepr9bs
FI6OEk+ox7mrZ5wNmd4QQGtHtjxsDzUQEaVbtW749/VZsoApmxv8/xaycasoAi5Q
P5eSQelp2Q0cvyzpZ7fxVutOcbDyUotFYbhu6A1Z5rNnD9jOVV5wfQJNDOgC7nhC
K4z7z+C5JfiTbs/q5JuE6roR80Ovn8PE6wBVT731fJL4OirWvr41mi0Bs7zUETU=
=trO5
-----END PGP SIGNATURE-----

--efT0PeBhI6sLgP6f1fH66LxasrdeRRKjl--




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

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


Received: (at submit) by debbugs.gnu.org; 21 Feb 2017 08:41:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 21 03:41:45 2017
Received: from localhost ([127.0.0.1]:48158 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cg612-0000lX-W8
	for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 03:41:45 -0500
Received: from eggs.gnu.org ([208.118.235.92]:58573)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1cg612-0000lK-14
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 03:41:44 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cg60w-0006d3-1H
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 03:41:38 -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]:33268)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cg60v-0006cz-UL
 for submit <at> debbugs.gnu.org; Tue, 21 Feb 2017 03:41:37 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49539)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cg60u-0000kE-PH
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 03:41:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cg60r-0006bO-LG
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 03:41:36 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:50108
 helo=Ishtar.sc.tlinx.org)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cg60r-0006b4-BW
 for bug-coreutils@HIDDEN; Tue, 21 Feb 2017 03:41:33 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 v1L8fQrv033485; Tue, 21 Feb 2017 00:41:28 -0800
Message-ID: <58ABFD36.9050703@HIDDEN>
Date: Tue, 21 Feb 2017 00:41:26 -0800
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix	for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
In-Reply-To: <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic] [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
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: -5.0 (-----)



> Or are you arguing that contents within the directory should be removed,
> even though the directory itself cannot be? 
---
	That's the way a recursive descent algorithm
works: it processes the contents, before the parents.

When it gets to the parent, it couldn't remove it, but
due to the "-f", silently failed.

	Do you really need me to find the older version
of 'rm' in your source tree?

	you know as well as I do, that the verbiage
about disallowing all subpaths under '.' wasn't in earlier
posix versions (say 2001 or before).

	It's not a matter of finding where it says it
is "allowed", rm was always recursive descent and posix
didn't disallow it. 

	Gnu says not to remove features or
behaviors due to changing posix standards...
So the old behavior should be reinstated as
default, and those that want the new behavior can
use POSIX_CORRECTLY (or whatever it is)...




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

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


Received: (at submit) by debbugs.gnu.org; 20 Feb 2017 21:11:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 20 16:11:52 2017
Received: from localhost ([127.0.0.1]:47854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cfvFQ-0007vD-24
	for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 16:11:52 -0500
Received: from eggs.gnu.org ([208.118.235.92]:54273)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1cfvFN-0007v0-UZ
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 16:11:50 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cfvFD-0008KT-0t
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 16:11:44 -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]:49170)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cfvFC-0008KP-T8
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 16:11:38 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44981)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cfvEy-0001u7-LD
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 16:11:38 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cfvE6-0007of-MV
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 16:11:24 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:40110
 helo=Ishtar.sc.tlinx.org)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cfvE6-0007o5-6w
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 16:10:30 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 v1KLAOhK061945; Mon, 20 Feb 2017 13:10:26 -0800
Message-ID: <58AB5B40.5090001@HIDDEN>
Date: Mon, 20 Feb 2017 13:10:24 -0800
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
 <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
In-Reply-To: <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id
 v1KLAOhK061945
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic] [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
Cc: bug-coreutils@HIDDEN
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: -5.0 (-----)



Eric Blake wrote:
> tag 25817 needinfo
> thanks
>=20
> On 02/20/2017 01:41 PM, L A Walsh wrote:
>=20
>> So... why should 'rm' not be able to start it's deletion
>> from the inside of a directory? (@ "." )?
>=20
> Please give more details as to what you think is broken.  Instead of
> describing the problem in vague prose, please show a shell transcript
> that creates a sample directory layout and cd's into the place that you
> want, then attempts the removal that currently fails, as well as
> explaining what you hoped to have happen instead of an error message.
-----
#!/bin/bash
cd /tmp || exit 1
mkdir tstdir || exit 1
mkdir tstdir/usr
mkdir tstdir/var
mount --bind /var /tmp/tstdir/var
mount --bind /usr /tmp/tstdir/usr
mkdir tstdir/{1,2,3}
cd /tmp/tstdir || exit
rm -fr . --one-file-system
---------
Output:
rm: refusing to remove =E2=80=98.=E2=80=99 or =E2=80=98..=E2=80=99 direct=
ory: skipping =E2=80=98.=E2=80=99
----
Instead, it should have removed dirs 1,2,3 and not=20
not 'var' or 'usr'.


----

rm originally did a depth first traversal and deletion
of files under it.

a few to several years ago a posix change was added to=20
change the depth-first traversal and to
inspect local paths before doing the depth-first traversal
of directories like '.' -- and if it found '.' to disallow
any paths below '.' (prior to the depth-first traversal that
used to happen).








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

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


Received: (at 25817) by debbugs.gnu.org; 20 Feb 2017 20:33:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 20 15:33:28 2017
Received: from localhost ([127.0.0.1]:47838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cfueG-00072E-8W
	for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 15:33:28 -0500
Received: from mx1.redhat.com ([209.132.183.28]:54586)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1cfueE-00071z-Gp
 for 25817 <at> debbugs.gnu.org; Mon, 20 Feb 2017 15:33:27 -0500
Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com
 [10.5.11.28])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 8021E4AE8E;
 Mon, 20 Feb 2017 20:33:21 +0000 (UTC)
Received: from [10.10.123.67] (unknown [10.10.123.67])
 by smtp.corp.redhat.com (Postfix) with ESMTP id ECCD415AB2;
 Mon, 20 Feb 2017 20:33:20 +0000 (UTC)
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
To: L A Walsh <coreutils@HIDDEN>, 25817 <at> debbugs.gnu.org
References: <58AB4670.3010209@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
Date: Mon, 20 Feb 2017 14:33:19 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <58AB4670.3010209@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="LDkRFILD0NpHnCMdCigAWXCXA4mcJvUcD"
X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.39]); Mon, 20 Feb 2017 20:33:21 +0000 (UTC)
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 25817
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: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--LDkRFILD0NpHnCMdCigAWXCXA4mcJvUcD
Content-Type: multipart/mixed; boundary="5LRv4iL2vavk4UmMFBcPiomsDtVcMtneb";
 protected-headers="v1"
From: Eric Blake <eblake@HIDDEN>
To: L A Walsh <coreutils@HIDDEN>, 25817 <at> debbugs.gnu.org
Message-ID: <9d8c76f1-56ba-9391-f602-71e6e7c736e7@HIDDEN>
Subject: Re: bug#25817: Why were Gnu coding standards violated in favor of
 posix for 'rm -fr .'?: request for reversion of behavior
References: <58AB4670.3010209@HIDDEN>
In-Reply-To: <58AB4670.3010209@HIDDEN>

--5LRv4iL2vavk4UmMFBcPiomsDtVcMtneb
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

tag 25817 needinfo
thanks

On 02/20/2017 01:41 PM, L A Walsh wrote:

> So... why should 'rm' not be able to start it's deletion
> from the inside of a directory? (@ "." )?

Please give more details as to what you think is broken.  Instead of
describing the problem in vague prose, please show a shell transcript
that creates a sample directory layout and cd's into the place that you
want, then attempts the removal that currently fails, as well as
explaining what you hoped to have happen instead of an error message.  I
will demonstrate below.  As written, your report is too vague to
definitively state whether coreutils behavior has even changed over
time, let alone whether such a change is, as you claim, a violation of
GNU Coding Standards.

>=20
> FWIW, because of the above change, rm is no longer consistent in its
> counting.  With "one-file-system", it means "1fs/starting path",
> not 1fs /rm command, whereas with "-I", it creates a global
> limit of '3' deletions before asking -- not 3 deletions/starting path.

I can't make enough sense of this paragraph without actual shell
commands being demonstrated to see what you are complaining about.

If you are complaining that:

$ mkdir tmp
$ cd tmp
$ touch file
$ rm -rf .
rm: refusing to remove '.' or '..' directory: skipping '.'
$ ls
file

fails not only to delete the current working directory, but refuses to
even attempt to remove 'file' within that directory, please remember
that the behavior I demonstrated is compliant with this wording in POSIX
2008 (including amendments by TC2 in 2016):
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

"If either of the files dot or dot-dot are specified as the basename
portion of an operand (that is, the final pathname component) or if an
operand resolves to the root directory, rm shall write a diagnostic
message to standard error and do nothing more with such operands."

At the time of this email, I have not researched whether this wording
has changed over time from older versions of POSIX.

Are you arguing that older versions of 'rm' (whether GNU or non-GNU)
and/or older versions of POSIX had different behavior/requirements?  If
so, can you please quote chapter-and-verse of those other standards, or
call out version numbers (or even commit ids) where it did what you
want, or any other thing you can do to make your point stronger that an
intentional (or possibly unintentional) change in behavior occurred, and
that there is indeed an alternative behavior worth supporting (even if
such alternative is not the default, it could still be triggered by a
new command-line option).

Or are you arguing that contents within the directory should be removed,
even though the directory itself cannot be?  Again, more details in your
complaint would go a long way to making a decision whether there is an
actual bug, or just a misunderstanding of current behavior.  It helps if
you can focus on the facts at hand ("what happens, what did you want to
happen") rather than making it a political attack ("you broke things and
aren't consistent" or in general any rant against POSIX).

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


--5LRv4iL2vavk4UmMFBcPiomsDtVcMtneb--

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

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

iQEcBAEBCAAGBQJYq1KPAAoJEKeha0olJ0NqijUH/jJ4yTBtob8kUnQ2XusGTxgS
5lsaWnzBWPpK9SlGjWNBajDPM2M3QCa+WZP35HczvBHI1DoHGGTwKvrIxox7m3xy
rt1b1ZvlIW5YkzDm1In/7KukqIOQtONMv7Fmg58r2WhBOvx1ZuHw0YDOG6Ju3RSy
lx2clOr+mmc8tWOC0zf2k7eV23DZCbPSUdglRfETaH4e78T0e3ZzZQ6jr/rc1wbo
FPsrrT8SoMv/thJn1B3H3OcBm0uKqsBDGDWv77tx7s+ZqBIUoc2pxQDQAKvx32DK
v8J6e1Ymg0gdV9Sk3WxCEihXUBjNvsh1Pzhxcbmzde4EntemEi07gXovtAV4xRg=
=AgY5
-----END PGP SIGNATURE-----

--LDkRFILD0NpHnCMdCigAWXCXA4mcJvUcD--




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

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


Received: (at submit) by debbugs.gnu.org; 20 Feb 2017 19:41:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 20 14:41:56 2017
Received: from localhost ([127.0.0.1]:47812 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cftqN-00043X-VH
	for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 14:41:56 -0500
Received: from eggs.gnu.org ([208.118.235.92]:33088)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <coreutils@HIDDEN>) id 1cftqM-00043I-GB
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 14:41:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cftqG-0007pG-Fk
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 14:41:49 -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]:58644)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cftqG-0007pC-DC
 for submit <at> debbugs.gnu.org; Mon, 20 Feb 2017 14:41:48 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52276)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cftqF-0004l0-3U
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 14:41:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1cftqB-0007oB-RG
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 14:41:47 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:34240
 helo=Ishtar.sc.tlinx.org)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <coreutils@HIDDEN>) id 1cftqB-0007nW-D7
 for bug-coreutils@HIDDEN; Mon, 20 Feb 2017 14:41:43 -0500
Received: from [192.168.3.12] (Athenae [192.168.3.12])
 by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 v1KJfana049861
 for <bug-coreutils@HIDDEN>; Mon, 20 Feb 2017 11:41:38 -0800
Message-ID: <58AB4670.3010209@HIDDEN>
Date: Mon, 20 Feb 2017 11:41:36 -0800
From: L A Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: Why were Gnu coding standards violated in favor of posix for 'rm
 -fr .'?: request for reversion of behavior
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by Ishtar.sc.tlinx.org id
 v1KJfana049861
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic] [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
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.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: -5.0 (-----)

In reading Gnu's Coding Standards (
https://www.gnu.org/prep/standards/standards.html#Non_002dGNU-Standards),
Under non-Gnu-Standards -- it is specifically talking about POSIX
compatibility when it says:

    In particular, don=E2=80=99t reject a new feature, or remove an old o=
ne,
    merely because a standard says it is =E2=80=9Cforbidden=E2=80=9D or =E2=
=80=9Cdeprecated=E2=80=9D.

So... why should 'rm' not be able to start it's deletion
from the inside of a directory? (@ "." )?

FWIW, because of the above change, rm is no longer consistent in its
counting.  With "one-file-system", it means "1fs/starting path",
not 1fs /rm command, whereas with "-I", it creates a global
limit of '3' deletions before asking -- not 3 deletions/starting path.

 From the above, changing 'rm' to disallow '.' in a path shouldn't have
been done.

Can this be fixed?  :-)

Thanks!
-linda







Acknowledgement sent to L A Walsh <coreutils@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#25817; 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, 29 Oct 2018 02:45:02 UTC

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