GNU bug report logs -
#25817
rm: add option to avoid early exit on "."
Previous Next
Full log
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
Eric Blake wrote:
> tag 25817 needinfo
> thanks
>
> On 02/20/2017 01:41 PM, L A Walsh wrote:
>
>> So... why should 'rm' not be able to start it's deletion
>> from the inside of a directory? (@ "." )?
>
> Please give more details as to what you think is broken. Instead of
> describing the problem in vague prose, please show a shell transcript
> that creates a sample directory layout and cd's into the place that you
> want, then attempts the removal that currently fails, as well as
> explaining what you hoped to have happen instead of an error message.
-----
#!/bin/bash
cd /tmp || exit 1
mkdir tstdir || exit 1
mkdir tstdir/usr
mkdir tstdir/var
mount --bind /var /tmp/tstdir/var
mount --bind /usr /tmp/tstdir/usr
mkdir tstdir/{1,2,3}
cd /tmp/tstdir || exit
rm -fr . --one-file-system
---------
Output:
rm: refusing to remove ‘.’ or ‘..’ directory: skipping ‘.’
----
Instead, it should have removed dirs 1,2,3 and not
not 'var' or 'usr'.
----
rm originally did a depth first traversal and deletion
of files under it.
a few to several years ago a posix change was added to
change the depth-first traversal and to
inspect local paths before doing the depth-first traversal
of directories like '.' -- and if it found '.' to disallow
any paths below '.' (prior to the depth-first traversal that
used to happen).
This bug report was last modified 6 years and 232 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.