[volunteers] Why you are careful about /dev/null operations as the root user

Rick Moen rick at linuxmafia.com
Thu Dec 17 08:51:40 PST 2015


Quoting Kevin Dankwardt (kevin.dankwardt at gmail.com):

> Thanks for the tip about checking with the mountpoint command.
> 
> I see that rm has the option --one-file-system that if I would remember to
> use I would also probably remember to umount. sigh. Maybe the
> --one-file-system should be the default for rm -rf. How often do you really
> want to remove things that are on different filesystems?

It's worth looking for in other commands, where it's often the -x
option, e.g. for cp and rsync, and I routinely include it in almost all
large file operations.

I don't expect --one-file-system to ever become the default for GNU cp 
(as the dangerous behaviour is now expected across Unixes), but maybe if
you (or me, or someone) were to open a feature request against GNU
coreutils the still-unused -x option could be assigned to it.

You know, when bind mounting was first introduced, my friend Jim Dennis
kept talking about how it's simultaneously very cool and also dangerous
for file operations, because it creates various situations that violate
the principle of least surprise.  He was right.

-- 
Cheers,                           (morganj): 0 is false and 1 is true, correct?
Rick Moen                         (alec_eso): 1, morganj
rick at linuxmafia.com               (morganj): bastard.
McQ! (4x80)                                     -- seen on IRC



More information about the volunteers mailing list