Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2007 16:47:56 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG
Subject:   Re: rm(1) bug, possibly serious
Message-ID:  <200709261447.l8QElua3058752@lurza.secnetix.de>
In-Reply-To: <54db43990709251838q68bdba95iefefb43029761c34@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Bob Johnson wrote:
 > Oliver Fromme wrote:
 > > By the way, an additional confusion is that ".." and "../"
 > > are handled differently.  Specifying ".." always leads to
 > > this message:
 > > 
 > > rm: "." and ".." may not be removed
 > > 
 > > and nothing is actually removed.  It is confusing that
 > > adding a slash leads to a different error message _and_
 > > removal of the contents of the parent directory.  Clearly
 > > a POLA violation.
 > 
 > Maybe. But I expect that the behavior for "rm -rf .." is there so
 > that things don't get REALLY astonishing when you do "rm -rf *".

The expansion of "*" does not include "." or "..".

(As a side note, i also think that a tool should not try
to mess with shell expansion, or make assumptions about it.
For example, most shells have an optional feature to ask
for confirmation when the user typed "rm *" or similar.
If a user wants such protection, he can enable it.  There
is no reason that rm(1) or other tools try to be clever
about it.)

 > Having a different behavior for "rm -rf ../" may have been
 > intentional on someone's part so you can override the protection
 > if you really want to.

If it was intentional, then there wouldn't be a misleading
error message (and exit code 1).

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 last good thing written in C was
Franz Schubert's Symphony number 9."
        -- Erwin Dieterich



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