From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 29 23:36:37 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3425F16A47C for ; Sun, 29 Oct 2006 23:36:37 +0000 (UTC) (envelope-from elessar@bsdforen.de) Received: from mail.bsdforen.de (bsdforen.de [212.204.60.79]) by mx1.FreeBSD.org (Postfix) with ESMTP id 751B743D64 for ; Sun, 29 Oct 2006 23:36:35 +0000 (GMT) (envelope-from elessar@bsdforen.de) Received: from localhost (mail [127.0.0.12]) by mail.bsdforen.de (Postfix) with ESMTP id 1859B4241CC for ; Mon, 30 Oct 2006 00:36:34 +0100 (CET) X-Virus-Scanned: amavisd-new at bsdforen.de Received: from mail.bsdforen.de ([127.0.0.12]) by localhost (mail.bsdforen.de [127.0.0.12]) (amavisd-new, port 10024) with ESMTP id dv8etLAPzcqb for ; Mon, 30 Oct 2006 00:36:33 +0100 (CET) Received: from loki.starkstrom.lan (p549CE11B.dip.t-dialin.net [84.156.225.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bsdforen.de (Postfix) with ESMTP id 0F3DD4241C8 for ; Mon, 30 Oct 2006 00:36:32 +0100 (CET) Date: Mon, 30 Oct 2006 00:36:28 +0100 From: Joerg Pernfuss To: freebsd-hackers@freebsd.org Message-ID: <20061030003628.42bc5f8d@loki.starkstrom.lan> In-Reply-To: <20061029222847.GA68272@marvin.astase.com> References: <20061029222847.GA68272@marvin.astase.com> X-Mailer: Sylpheed-Claws 2.2.3 (GTK+ 2.8.20; i386-portbld-freebsd6.1) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_6OnIi496Ye01RJ76_ZatY=U"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Subject: Re: [patch] rm can have undesired side-effects X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Oct 2006 23:36:37 -0000 --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 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--