rm(1) bug, possibly serious
Oliver Brandmueller
ob at e-Gitt.NET
Tue Sep 25 14:54:16 PDT 2007
Hi,
On Tue, Sep 25, 2007 at 11:25:34AM -0400, Maxim Khitrov wrote:
> On 9/25/07, Oliver Fromme <olli at 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).
>
> 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 at nowhere:ttyp2 [~] which rm
/bin/rm
(23:49) ob at nowhere:ttyp2 [~] cd /tmp
(23:49) ob at nowhere:ttyp2 [/tmp] mkdir -p foo/bar
(23:49) ob at nowhere:ttyp2 [/tmp] cd foo/bar
(23:49) ob at nowhere:ttyp2 [foo/bar] rm -rf ../
(23:49) ob at nowhere:ttyp2 [foo/bar] pwd
pwd: .: No such file or directory
(23:52) ob at nowhere:ttyp2 [foo/bar] cd /tmp
(23:52) ob at nowhere:ttyp2 [/tmp] ls
(23:52) ob at nowhere:ttyp2 [/tmp]
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 at nowhere:ttyp2 [~] uname -a
FreeBSD nowhere.ob-home.lan 6.2-STABLE FreeBSD 6.2-STABLE #17: Sun Aug 5 19:03:13 CEST 2007 root at nowhere.ob-home.lan:/usr/obj/usr/src/sys/NOWHERE i386
- Olli
--
| 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! |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20070925/283ea5fc/attachment.pgp
More information about the freebsd-stable
mailing list