Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2006 00:36:28 +0100
From:      Joerg Pernfuss <elessar@bsdforen.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: [patch] rm can have undesired side-effects
Message-ID:  <20061030003628.42bc5f8d@loki.starkstrom.lan>
In-Reply-To: <20061029222847.GA68272@marvin.astase.com>
References:  <20061029222847.GA68272@marvin.astase.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_6OnIi496Ye01RJ76_ZatY=U
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Sun, 29 Oct 2006 23:28:47 +0100
Romain Tartiere <romain-tartiere@astase.com> wrote:

> The rm utility provides a "-P" option for overwriting files before
> removing them. I was wondering about the behaviour of it on regular
> files with more than one hard link.
> I just wrote a few lines in a file, created an hard link to it and "rm
> -P" the first one. The content of the second one was just lost too.

Of course. It is the same file. Every other outcome would indicate
a serious bug somewhere in the filesystem code.

> I guess that it can be fixed (in case it is not desired) by:
>  - Ignoring the -P option when the link count is greater then one, or

Silently ignoring user specified options is seldom a good way to go.
The user explicitly stated he wants to wipe the file contents.

>  - Asking the user whether he is ready to lose data, assuming "no" if
>    the -f option is set, or
>  - Asking the user whether he is ready to lose data, assuming "yes" if
>    the -f option is set.

As -f is the `i know how to shoot my feet' option, a user should be
allowed to do so, therefor the second one of these two is better.

I guess it boils down to the question how well people understand the
linkcount in `ls -l' and how much FreeBSD wants to hold the user's hand.

Personally, i'd go nuts if rm(1) constantly asks if I am sure I want
to delete that file, because deleted files are lost. If I ever want
that, I can set `rm -i' as alias for rm.

	Joerg
--=20
| /"\   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.    |

--Sig_6OnIi496Ye01RJ76_ZatY=U
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (FreeBSD)

iD8DBQFFRTr8H31s/bvKrSQRAr9+AJ44c/CoBqrts86vXa+G1Xg8S6CU7ACeO46n
Wu6LU20fqfCZAJ2daa3rlrE=
=1TnD
-----END PGP SIGNATURE-----

--Sig_6OnIi496Ye01RJ76_ZatY=U--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061030003628.42bc5f8d>