Re: rm(1) bug, possibly serious



On Tue, 25 Sep 2007 17:12:50 +0200 (CEST)
Oliver Fromme <olli@xxxxxxxxxxxxxxxxx> wrote:

$ cd /tmp
$ mkdir -p foo/var
$ cd foo/bar
$ rm -rf ../
rm: ../: Invalid argument
$ rm -rf ../
$

Note that the command "rm -rf ../" was entered twice.
The first time I got an error message (and exit code 1),
the second time it apparently succeeded. The very same
command.

What happens if you issue a 'pwd' command after each 'rm -rf ../'?
We want to see the output.

IMHO, the only way the second rm command *should* succeed, is if it
invalidates the current working directory, thus releasing the last lock
on the directory.

Quick testing here:
tingo@kg-work$ mkdir -p foo/bar
tingo@kg-work$ cd foo/bar
tingo@kg-work$ ll
total 4
drwxr-xr-x 2 tingo wheel - 512 Sep 25 17:31 ./
drwxr-xr-x 3 tingo wheel - 512 Sep 25 17:31 ../
tingo@kg-work$ pwd
/tmp/foo/bar
tingo@kg-work$ rm -rf ../
rm: ../: Invalid argument
tingo@kg-work$ pwd
/tmp/foo/bar
tingo@kg-work$ rm -rf ../
tingo@kg-work$ pwd
/tmp/foo/bar
tingo@kg-work$ ls -al
total 0
tingo@kg-work$ ll
total 0
tingo@kg-work$ pwd
/tmp/foo/bar
tingo@kg-work$ ls -al ..
ls: ..: No such file or directory
tingo@kg-work$ ls -al /tmp/foo/bar
ls: /tmp/foo/bar: No such file or directory
tingo@kg-work$ ls -al /tmp/foo
total 8
drwxr-xr-x 2 tingo wheel 512 Sep 25 17:32 .
drwxrwxrwt 35 root wheel 5632 Sep 25 17:31 ..


Ok, I think it is a bug.
--
Regards,
Torfinn Ingolfsen

_______________________________________________
freebsd-stable@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@xxxxxxxxxxx"



Relevant Pages