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 and bash 5.0. Interestingly, however, rm -rf // only does the following (and globbing in zsh evals /*/* to //): "root@test:~# rm -rf // rm: it is dangerous to operate recursively on '//' (same as '/') rm: use --no-preserve-root to override this failsafe” I don’t think anything in POSIX demands bash's behavior, and I believe illumos has already solved this problem in a POSIX compliant fashion, by failing when the user tries to remove the current working directory, see: https://www.youtube.com/watch?v=l6XQUciI-Sc&t=4903s I also submitted this report to GNU coreutils. Appreciate your attention to this bug! -- ---------------------------------------------- ROBERT SWINFORD ---------------------------------------------- robert.swinf...@gmail.com <mailto:robert.swinf...@gmail.com> m: (405) 209-2339 ---------------------------------------------- > Begin forwarded message: > > From: Robert Swinford <robert.swinf...@gmail.com> > Subject: Re: Bug: rm -rf /*/* > Date: November 30, 2021 at 2:08:35 PM CST > To: bug-coreut...@gnu.org > > BTW, zsh globbing doesn’t exhibit this behavior! It seems it is only a > problem in bash. > > -- > ---------------------------------------------- > ROBERT SWINFORD > ---------------------------------------------- > robert.swinf...@gmail.com > m: (405) 209-2339 > ---------------------------------------------- > >> On Nov 30, 2021, at 1:58 PM, Robert Swinford <robert.swinf...@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@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.swinf...@gmail.com >> m: (405) 209-2339 >> ---------------------------------------------- >> >