Re: rm(1) bug, possibly serious



On Tue, 25 Sep 2007, LI Xin wrote:
Oliver Fromme wrote:
Nicolas Rachinsky 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.

Clearly a bug, and well spotted, especially if as old as reported.

>
> Adding a slash often leads to different behaviour.

Yes, I'm aware of that. I often make use of the feature
that "find /sys/" expands the symlink, while "find /sys"
does not. The same holds true for ls(1).

But fortunately not for rm(1):

The rm utility removes symbolic links, not the files referenced by the
links.

It is an error to attempt to remove the files /, . or ..

However, I would still argue that there is no sane reason
for "rm -rf ../" behaving differently from "rm -rf ..",
especially because it behaves differently in a destructive
way. That's why I call it a POLA violation.

Also a POSIX violation IMHO :-)

Indeed; I can't imagine a situation where removing "." (let alone "..")
and so orphaning the pwd might be considered sane, never mind legal ..
but maybe I lack imagination :)

Cheers, Ian

_______________________________________________
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

  • Re: rm(1) bug, possibly serious
    ... > Oliver Fromme wrote: ... It is confusing that ... I would still argue that there is no sane reason ... That's why I call it a POLA violation. ...
    (freebsd-stable)
  • Re: mergemaster annoyance or not?
    ... On Friday 13 March 2009 01:35:27 Oliver Fromme wrote: ... I agree it's a POLA violation, but it is rather annoying they can't be made ... mergemaster.. ... for Genesis Software - http://www.gsoft.com.au ...
    (freebsd-stable)