Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2007 23:54:14 +0200
From:      Oliver Brandmueller <ob@e-Gitt.NET>
To:        freebsd-stable@freebsd.org
Subject:   Re: rm(1) bug, possibly serious
Message-ID:  <20070925215414.GQ23625@e-Gitt.NET>
In-Reply-To: <26ddd1750709250825j2d70798awa96cd0d2d305e0a9@mail.gmail.com>
References:  <200709251512.l8PFCoPe006574@lurza.secnetix.de> <26ddd1750709250825j2d70798awa96cd0d2d305e0a9@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--nVMJ2NtxeReIH9PS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

On Tue, Sep 25, 2007 at 11:25:34AM -0400, Maxim Khitrov wrote:
> On 9/25/07, Oliver Fromme <olli@lurza.secnetix.de> wrote:
> > To add further confusion, another "rm -rf ../" does
> > not print an error message and seemingly succeeds,
> > even though ".." does not exist anymore in the current
> > directory (which has been removed).
>=20
> Confirmed on CURRENT as well. Note that if you run rf -rf .. as the
> first command, the command does fail with 'rm: "." and ".." may not be
> removed'. Adding a / at the end does seem to get around this check.

May I add some more confusion?

In tcsh:

(23:49) ob@nowhere:ttyp2 [~] which rm
/bin/rm
(23:49) ob@nowhere:ttyp2 [~] cd /tmp
(23:49) ob@nowhere:ttyp2 [/tmp] mkdir -p foo/bar
(23:49) ob@nowhere:ttyp2 [/tmp] cd foo/bar
(23:49) ob@nowhere:ttyp2 [foo/bar] rm -rf ../
(23:49) ob@nowhere:ttyp2 [foo/bar] pwd
pwd: .: No such file or directory
(23:52) ob@nowhere:ttyp2 [foo/bar] cd /tmp
(23:52) ob@nowhere:ttyp2 [/tmp] ls
(23:52) ob@nowhere:ttyp2 [/tmp]=20


In sh:

$ which rm
/bin/rm
$ cd /tmp
$ mkdir -p foo/bar
$ cd foo/bar
$ rm -rf ../
rm: ../: Invalid argument
$ pwd
/tmp/foo/bar
$ rm -rf ../
$ pwd
/tmp/foo/bar
$ cd /tmp
$ ls
foo
$ cd foo
$ ls


(23:53) ob@nowhere:ttyp2 [~] uname -a
FreeBSD nowhere.ob-home.lan 6.2-STABLE FreeBSD 6.2-STABLE #17: Sun Aug  5 1=
9:03:13 CEST 2007     root@nowhere.ob-home.lan:/usr/obj/usr/src/sys/NOWHERE=
  i386


- Olli


--=20
| Oliver Brandmueller | Offenbacher Str. 1  | Germany       D-14197 Berlin |
| Fon +49-172-3130856 | Fax +49-172-3145027 | WWW:   http://the.addict.de/ |
|               Ich bin das Internet. Sowahr ich Gott helfe.               |
| Eine gewerbliche Nutzung aller enthaltenen Adressen ist nicht gestattet! |

--nVMJ2NtxeReIH9PS
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFG+YOGiqtMdzjafykRArgaAJ4qw2WOfoW2zCzJlE3+S4gdjYbIYwCeLKqi
uFmhjTml+SX6X65zaayg8RQ=
=z1Bv
-----END PGP SIGNATURE-----

--nVMJ2NtxeReIH9PS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070925215414.GQ23625>