From owner-freebsd-stable@FreeBSD.ORG Tue Sep 25 16:30:31 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F100D16A41A for ; Tue, 25 Sep 2007 16:30:31 +0000 (UTC) (envelope-from oleg@admin.opentransfer.com) Received: from admin.opentransfer.com (admin.opentransfer.com [71.18.255.169]) by mx1.freebsd.org (Postfix) with ESMTP id 9430513C468 for ; Tue, 25 Sep 2007 16:30:31 +0000 (UTC) (envelope-from oleg@admin.opentransfer.com) Received: from admin.opentransfer.com (admin.opentransfer.com [127.0.0.1]) by admin.opentransfer.com (8.13.8/8.13.8) with ESMTP id l8PFU3f0004504 for ; Tue, 25 Sep 2007 10:30:03 -0500 Received: (from oleg@localhost) by admin.opentransfer.com (8.13.8/8.13.8/Submit) id l8PFU3ug004503 for freebsd-stable@freebsd.org; Tue, 25 Sep 2007 10:30:03 -0500 Date: Tue, 25 Sep 2007 10:30:03 -0500 From: Oleg Nauman To: freebsd-stable@freebsd.org Message-ID: <20070925153003.GA3258@admin.opentransfer.com> Mail-Followup-To: freebsd-stable@freebsd.org References: <200709251512.l8PFCoPe006574@lurza.secnetix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200709251512.l8PFCoPe006574@lurza.secnetix.de> User-Agent: Mutt/1.4.2.1i Subject: Re: rm(1) bug, possibly serious X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2007 16:30:32 -0000 On Tue, Sep 25, 2007 at 05:12:50PM +0200, Oliver Fromme wrote: > Hi, > > Today I noticed the following behaviour on a 6-stable > machine: > > $ cd /tmp > $ mkdir -p foo/var > $ cd foo/bar Looks like you have mistyped 'mkdir' argument :) > $ rm -rf ../ > rm: ../: Invalid argument Please type 'pwd' here > $ 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. > > Further investigation: > > $ cd /tmp > $ mkdir -p foo/var > $ cd foo/bar > $ rm -rf ../ > rm: ../: Invalid argument > $ ls -al .. > ls: ..: No such file or directory > $ ls /tmp/foo/bar > ls: /tmp/foo/bar: No such file or directory > > That means: Even though "rm -rf ../" prints an error > message, indicating that the argument is invalid, it > *DOES* remove the contents of the parent directory! > > 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). > > Shall I file a PR? Or is rm working correctly, and > my assumptions are wrong? > > Best regards > Oliver > > -- > Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. > Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: > secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- > chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart > > FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd > > "The scanf() function is a large and complex beast that often does > something almost but not quite entirely unlike what you desired." > -- Chris Torek -- The ultimate artifact may be found in the driven snow...