[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [off-topic] rm -r on a used directory



fpolacco@icenet.fi  wrote on 16.01.98 in <[🔎] 199801152158.XAA13990@icenet.fi>:

> On 14 Jan, Adrian Bridgett wrote:
> > At work on AIX, if I do this:
> >
> >   mkdir foo
> >   mkdir foo/bar
> >   cd foo/bar
> >   rm -r ../../foo
> >
> > the last command fails as it is my current directory. This works without a
> > problem on Linux - it just leaves me in a non-existant dir.
>
> Are you sure that it works without a problem?
>
> 	$ rm -r ../../foo ; echo $?
> 	rm: ../../foo: No such file or directory
> 	rm: ../../foo: No such file or directory
> 	1
>
> it failed, as you can see ...
>
> 	$ ls .
> 	/bin/ls: .: No such file or directory
>
> ... and leaves you in troubles ...
>
> 	$ ls -lA /tmp/a/b/c/
> 	total 1
> 	drwxr-xr-x   2 fab      fab          1024 Jan 15 11:12 foo
>
> without having removed the requested dir

Partly. It did remove bar.

Try to use a path to foo not needing those ../ links, however, and it  
works perfectly - which means that rm -r tries to use the argument for  
accessing those directories: after removing bar, the path no longer works,  
so rm is unable to access foo to remove it as well.

> I think that AIX behaviour is better.

Why?

> Are you sure that Posix doesn't require that . should always exist?

It certainly doesn't require that you can actually use it for anything.

Try this, as non-root:

$ mkdir x
$ cd x
$ chmod 000 .
$ ls
ls: .: Keine Berechtigung
$ cd ..
bash: cd: ..: Keine Berechtigung

Sure looks the same.


MfG Kai


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: