[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it
From: |
Alan Curry |
Subject: |
bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it |
Date: |
Fri, 7 Sep 2012 17:08:44 -0500 (GMT+5) |
Eric Blake writes:
>
> Indeed, reading the original V7 source code from 1979:
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=3DV7/usr/src/cmd/rm.c
>
[...]
>
> shows that _only_ ".." was special, "." was attempted in-place and
> didn't fail until the unlink(".") after the directory itself had been
> emptied. It wasn't until later versions of code that "." also became
> special.
I also decided to look around there, and found some of the turning points:
Up to 4.2BSD, the V7 behavior was kept.
(http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/bin/rm.c)
rm -rf . was forbidden in 4.3BSD (26 years ago).
http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/src/bin/rm.c
The removal of dir/. (and dir/..) was not forbidden until Reno.
http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/bin/rm/rm.c
cp = rindex(arg, '/');
if (cp == NULL)
cp = arg;
else
++cp;
if (isdot(cp)) {
fprintf(stderr, "rm: cannot remove `.' or `..'\n");
return (0);
}
Maybe the classical behavior stuck around longer in the more SysV-ish Unices.
The Ultrix-11 3.1 tree on TUHS from 1988 has a rm that looks very much like
V7, but I can't find anything to compare it to until OpenSolaris.
Did POSIX force BSD to change their rm in 1988? I think it's more likely that
POSIX simply documents a restriction that BSD had already added. Either way
the latest POSIX revisions certainly can't be blamed.
--
Alan Curry
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., (continued)
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Jim Meyering, 2012/09/06
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Linda Walsh, 2012/09/06
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Jim Meyering, 2012/09/06
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Bob Proulx, 2012/09/06
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Eric Blake, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Eric Blake, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so., Eric Blake, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it,
Alan Curry <=
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Eric Blake, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Paul Eggert, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Linda Walsh, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Alan Curry, 2012/09/07
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Linda Walsh, 2012/09/08
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Alan Curry, 2012/09/08
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Linda Walsh, 2012/09/08
- bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it, Paul Eggert, 2012/09/08