From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 30 01:44:05 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 02CA516A494 for ; Mon, 30 Oct 2006 01:44:05 +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 687AE43D5D for ; Mon, 30 Oct 2006 01:44:02 +0000 (GMT) (envelope-from elessar@bsdforen.de) Received: from localhost (mail [127.0.0.12]) by mail.bsdforen.de (Postfix) with ESMTP id 51C144241C8 for ; Mon, 30 Oct 2006 02:44:01 +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 ot-bz5sv4wTM for ; Mon, 30 Oct 2006 02:44:01 +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 7B208423DE4 for ; Mon, 30 Oct 2006 02:44:00 +0100 (CET) Date: Mon, 30 Oct 2006 02:43:58 +0100 From: Joerg Pernfuss To: Message-ID: <20061030024358.39a12359@loki.starkstrom.lan> In-Reply-To: <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk> References: <20061029222847.GA68272@marvin.astase.com> <20061030003628.42bc5f8d@loki.starkstrom.lan> <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk> 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_72hEnRl=0BuVy3QGkiY+3eW"; 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: Mon, 30 Oct 2006 01:44:05 -0000 --Sig_72hEnRl=0BuVy3QGkiY+3eW Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 29 Oct 2006 23:57:45 -0000 "Steven Hartland" wrote: > That maybe the case but does rm -f remove all copies? > Nope so its behaviour is safe even with multiple hardlinks. >=20 > From the description I've seen thats not the case for -P > here and as such I dont think its quite a simple as that. The problem is that -P is the only option that actually modifies data instead of just the filesystem. From the online man pages it was added somewhere between 4.3BSD and 4.4BSD Lite2, so the FreeBSD CVS doesn't cover the initial -P commit. The option also does not seem to be POSIX or sth similar, but a historic BSD thing. =20 > My personal preference would be for it to warn or perhaps > error if the link count is not zero. Possibly use -f to > override this but even that I'd say is dangerous. s/not zero/greater than one/ 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 External behaviour: - bcwipe ignores the link count - GNU's shred ignores the link count too (`shred $file' as well as `shred -u $file') 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 :) That would mean that `rm -P ' with having a link count of at least 2, would behave like `rm ' (and like Romain suggested). 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_72hEnRl=0BuVy3QGkiY+3eW Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (FreeBSD) iD8DBQFFRVjeH31s/bvKrSQRAtHgAJ9rBMUnz5YfyZQZgTh/2PnkSI8D0QCaAxvy t7L5/tdZ5ley+qsavqqtXog= =yVEr -----END PGP SIGNATURE----- --Sig_72hEnRl=0BuVy3QGkiY+3eW--