[patch] rm can have undesired side-effects

Matthew Dillon dillon at apollo.backplane.com
Sun Nov 5 03:02:52 UTC 2006


:...
:BSD behaviour:
:- OpenBSD handles hardlinks since 3.3:
:     -P      Overwrite regular files before deleting them.  Files
:	     are overwritten three times, first with the byte pattern
:	     0xff, then 0x00, and then 0xff again, before they are
:	     deleted.  Files with multiple links will not be overwritten.
:- NetBSD uses 0xff, 0x00 and then random data. Ignores link count
:- DragonFlyBSD has the same behaviour as FreeBSD
:
:...
:Although I am a big defender of "the user should know what he does",
:the "right thing to do"[TM] would probably be to sync the behaviour
:of FreeBSD's rm(1) to OpenBSD and lobby NetBSD and DragonFlyBSD to do
:the same :)
:
:	Joerg

    I agree.  I will make this change in DragonFly right now, in fact.
    The -P option really needs to be consistent across environments
    and my take on the original design was so users could alias rm to
    rm -P in their .cshrc files.  Clearly it cannot destroy the contents
    of the file in the presence of hard links when used in that context.

					-Matt



More information about the freebsd-hackers mailing list