[patch] rm can have undesired side-effects

Joerg Pernfuss elessar at bsdforen.de
Mon Oct 30 02:15:38 UTC 2006


On Mon, 30 Oct 2006 12:30:02 +1030
"Daniel O'Connor" <doconnor at gsoft.com.au> wrote:

> > Silently ignoring user specified options is seldom a good way to go.
> > The user explicitly stated he wants to wipe the file contents.
> 
> I disagree that the user really meant to wipe the file if its link
> count is >1.

That of course may or may not be true. I still do not like the 'silent'
part.

> IMO having rm -P not wipe the file if its link count is >1 is a good
> idea. if you are deleting a tree containing a file with links then
> this will result in the file getting wiped in the end anyway because
> the link count will be 1 after the first link is removed.
> 
> It would be easy enough to add a diagnostic message in the -P case
> where the link count is >1.

Yes, see my other mails. Bahviour similar to OpenBSD (don't overwrite,
generate warning, unlink) is probably what should be done.

The pitfall may really be too big.

	Joerg
-- 
| /"\   ASCII ribbon   |  GnuPG Key ID | e86d b753 3deb e749 6c3a |
| \ / campaign against |    0xbbcaad24 | 5706 1f7d 6cfd bbca ad24 |
|  X    HTML in email  |        .the next sentence is true.       |
| / \     and news     |     .the previous sentence was a lie.    |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20061030/3dc0bbb9/signature.pgp


More information about the freebsd-hackers mailing list