Re: RFC: rm --preserve-root=all to protect mount points
From:
Pádraig Brady
Subject:
Re: RFC: rm --preserve-root=all to protect mount points
Date:
Sat, 16 Jun 2018 21:47:50 -0700
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 11/06/18 12:18, Kaz Kylheku (Coreutils) wrote:
> On 2018-06-10 23:14, Pádraig Brady wrote:
>> I was asked off list to consider adding an option to rm
>> that could be enabled with an alias, and would protect
>> mount points specified on the command line.
> [...]
>> $ rm -r --preserve-root=all /dev/shm
>> rm: skipping '/dev/shm', since it's a mount point
>> rm: and --preserve-root=all is in effect
>
> The command option is well-named, but consider changing
> "mount point" to "mount" in this diagnostic and, more
> importantly, any documentation which refers to this.
>
> E.g. "since a filesystem is mounted there",
> "since it is a filesystem root", etc.
>
> I think the "mount point" terminology is misleading because
> one important sense of the word is that it refers to the
> Unix kludge of requiring an empty directory to exist for
> a mount. The empty directory where one intends to mount a
> filesystem is the "mount point" for it.
>
> This option cannot protect directories which are mount
> points in that sense; only ones that are carrying mounts.
Yes this is a good point (pardon the pun).
I'm currently going with:
$ rm -r --preserve-root=all /dev/shm
rm: skipping '/dev/shm', since a file system is mounted there
rm: and --preserve-root=all is in effect
thanks,
Pádraig