GNU bug report logs - #52206
Bug: rm -rf /*/*

Previous Next

Package: coreutils;

Reported by: Robert Swinford <robert.swinford <at> gmail.com>

Date: Tue, 30 Nov 2021 20:27:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

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

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

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


Report forwarded to bug-coreutils <at> gnu.org:
bug#52206; Package coreutils. (Tue, 30 Nov 2021 20:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Swinford <robert.swinford <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 30 Nov 2021 20:27:01 GMT) Full text and rfc822 format available.

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

From: Robert Swinford <robert.swinford <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Bug: rm -rf /*/*
Date: Tue, 30 Nov 2021 13:58:32 -0600
TWIMC:

This seems like a bug: https://twitter.com/nixcraft/status/1465599844299411458

I was able to replicate the behavior in a container with coreutils version 8.30.

Interestingly, however, rm -rf // only does the following:

"root <at> test:~# rm -rf //
rm: it is dangerous to operate recursively on '//' (same as '/')
rm: use --no-preserve-root to override this failsafe"

I believe illumos has already solved this problem in a POSIX compliant fashion, see: https://www.youtube.com/watch?v=l6XQUciI-Sc&t=4903s

Appreciate your attention to this bug!

--
----------------------------------------------
ROBERT SWINFORD
----------------------------------------------
robert.swinford <at> gmail.com
m: (405) 209-2339
----------------------------------------------





Information forwarded to bug-coreutils <at> gnu.org:
bug#52206; Package coreutils. (Tue, 30 Nov 2021 20:44:02 GMT) Full text and rfc822 format available.

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

From: Robert Swinford <robert.swinford <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Re: Bug: rm -rf /*/*
Date: Tue, 30 Nov 2021 14:08:35 -0600
BTW, zsh globbing doesn’t exhibit this behavior!  It seems it is only a problem in bash.

--
----------------------------------------------
ROBERT SWINFORD
----------------------------------------------
robert.swinford <at> gmail.com
m: (405) 209-2339
----------------------------------------------

> On Nov 30, 2021, at 1:58 PM, Robert Swinford <robert.swinford <at> gmail.com> wrote:
> 
> TWIMC:
> 
> This seems like a bug: https://twitter.com/nixcraft/status/1465599844299411458
> 
> I was able to replicate the behavior in a container with coreutils version 8.30.
> 
> Interestingly, however, rm -rf // only does the following:
> 
> "root <at> test:~# rm -rf //
> rm: it is dangerous to operate recursively on '//' (same as '/')
> rm: use --no-preserve-root to override this failsafe"
> 
> I believe illumos has already solved this problem in a POSIX compliant fashion, see: https://www.youtube.com/watch?v=l6XQUciI-Sc&t=4903s
> 
> Appreciate your attention to this bug!
> 
> --
> ----------------------------------------------
> ROBERT SWINFORD
> ----------------------------------------------
> robert.swinford <at> gmail.com
> m: (405) 209-2339
> ----------------------------------------------
> 





Information forwarded to bug-coreutils <at> gnu.org:
bug#52206; Package coreutils. (Tue, 30 Nov 2021 20:57:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Robert Swinford <robert.swinford <at> gmail.com>
Cc: 52206 <at> debbugs.gnu.org
Subject: Re: bug#52206: Bug: rm -rf /*/*
Date: Tue, 30 Nov 2021 12:56:04 -0800
On 11/30/21 11:58, Robert Swinford wrote:

> This seems like a bug: https://twitter.com/nixcraft/status/1465599844299411458

I don't see a coreutils bug there: rm operated as specified.

> Interestingly, however, rm -rf // only does the following:

Yes, that's a special feature of GNU rm.

> I believe illumos has already solved this problem in a POSIX compliant fashion

Not sure what you're talking about here. Could you be specific? Don't 
have time to watch videos.

> BTW, zsh globbing doesn’t exhibit this behavior!  It seems it is only a problem in bash.

In that case, the bug (whatever it is) wouldn't be a coreutils bug.




Information forwarded to bug-coreutils <at> gnu.org:
bug#52206; Package coreutils. (Wed, 01 Dec 2021 06:39:01 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: Robert Swinford <robert.swinford <at> gmail.com>, 52206 <at> debbugs.gnu.org
Subject: Re: bug#52206: Bug: rm -rf /*/*
Date: Tue, 30 Nov 2021 23:38:02 -0700
Paul Eggert wrote:
> Robert Swinford wrote:
> > This seems like a bug: https://twitter.com/nixcraft/status/1465599844299411458
> 
> I don't see a coreutils bug there: rm operated as specified.

Agreed.  It's not an rm bug.  It's definitely unfortunate.  It's
similarly unfortunate to riding a bicycle into a lake.  But it isn't a
defect in the bicycle that it could not prevent someone from riding it
into a lake.

> > Interestingly, however, rm -rf // only does the following:
> 
> Yes, that's a special feature of GNU rm.

And apparently Bryan Cantrill reports that Solaris has the same
feature as GNU rm does for "rm -rf /" protection.

> > I believe illumos has already solved this problem in a POSIX compliant fashion
> 
> Not sure what you're talking about here. Could you be specific? Don't have
> time to watch videos.

I watched the cited video.  It features an interview with Bryan
Cantrill who very dynamically and entertainingly tells a story about a
scripted "rm -rf $1/$2" without checking if $1 and $2 were set or
unset resulting in "rm -rf /" being run by accident.  And therefore he
reports that Solaris implemented the prevention of running "rm -rf /".
This is said at time 1:27:00 in the video.  Which I note is the same
protection as GNU rm does.  So there isn't anything for GNU rm to
implement in order to match Solaris as it appears to be the same by
this report.

However $var1/$var2 expanding to / when those variables are not set is
a different case than /*/* expansion which has no variables and is
simply an error of usage.

> > BTW, zsh globbing doesn’t exhibit this behavior!  It seems it is only a problem in bash.
> 
> In that case, the bug (whatever it is) wouldn't be a coreutils bug.

I don't understand the comment that zsh doesn't expand the glob /*/*
and I tried it and verified that it does indeed expand that glob
sequence.

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#52206; Package coreutils. (Wed, 01 Dec 2021 06:50:02 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: Robert Swinford <robert.swinford <at> gmail.com>, 52206 <at> debbugs.gnu.org
Subject: Re: bug#52206: Bug: rm -rf /*/*
Date: Tue, 30 Nov 2021 23:49:02 -0700
Bob Proulx wrote:
> Paul Eggert wrote:
> > Robert Swinford wrote:
> > > BTW, zsh globbing doesn’t exhibit this behavior!  It seems it is only a problem in bash.
> >
> > In that case, the bug (whatever it is) wouldn't be a coreutils bug.
>
> I don't understand the comment that zsh doesn't expand the glob /*/*
> and I tried it and verified that it does indeed expand that glob
> sequence.

Lawrence Velazquez made sense of this on the bug-bash list.

    https://lists.gnu.org/archive/html/bug-bash/2021-11/msg00193.html

Bob




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 01 Dec 2021 18:11:01 GMT) Full text and rfc822 format available.

Notification sent to Robert Swinford <robert.swinford <at> gmail.com>:
bug acknowledged by developer. (Wed, 01 Dec 2021 18:11:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Bob Proulx <bob <at> proulx.com>
Cc: Robert Swinford <robert.swinford <at> gmail.com>, 52206-done <at> debbugs.gnu.org
Subject: Re: bug#52206: Bug: rm -rf /*/*
Date: Wed, 1 Dec 2021 10:10:51 -0800
Thanks for explaining. As this is not an rm bug, I'm closing the bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Dec 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 79 days ago.

Previous Next


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