Date: Tue, 25 Sep 2007 17:36:34 +0200 From: Torfinn Ingolfsen <torfinn.ingolfsen@broadpark.no> To: freebsd-stable@freebsd.org Subject: Re: rm(1) bug, possibly serious Message-ID: <20070925173634.89748abe.torfinn.ingolfsen@broadpark.no> In-Reply-To: <200709251512.l8PFCoPe006574@lurza.secnetix.de> References: <200709251512.l8PFCoPe006574@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 25 Sep 2007 17:12:50 +0200 (CEST) Oliver Fromme <olli@lurza.secnetix.de> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070925173634.89748abe.torfinn.ingolfsen>