rm(1) bug, possibly serious
Bob Johnson
fbsdlists at gmail.com
Tue Sep 25 19:03:00 PDT 2007
On 9/25/07, Oliver Fromme <olli at lurza.secnetix.de> wrote:
> Torfinn Ingolfsen wrote:
> > Oliver Fromme wrote:
> >
> > > $ cd /tmp
> > > $ mkdir -p foo/var
> > > $ cd foo/bar
> > > $ rm -rf ../
> > > rm: ../: Invalid argument
> > > $ rm -rf ../
> > > $
> > >
[...]
> > Quick testing here:
> > [...]
> > Ok, I think it is a bug.
>
> Yes, I think so, too.
>
> 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 *". 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.
- Bob
More information about the freebsd-stable
mailing list