Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 10 Sep 2011 20:02:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 16:02:45 2011 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1R2TlE-0005cY-Rs for submit <at> debbugs.gnu.org; Sat, 10 Sep 2011 16:02:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <jim@HIDDEN>) id 1R2TlB-0005cP-Ab for submit <at> debbugs.gnu.org; Sat, 10 Sep 2011 16:02:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <jim@HIDDEN>) id 1R2Th6-0000aG-VA for submit <at> debbugs.gnu.org; Sat, 10 Sep 2011 15:58:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:39396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <jim@HIDDEN>) id 1R2Th6-0000aC-Tl for submit <at> debbugs.gnu.org; Sat, 10 Sep 2011 15:58:28 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <jim@HIDDEN>) id 1R2Th5-00028b-UI for bug-coreutils@HIDDEN; Sat, 10 Sep 2011 15:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <jim@HIDDEN>) id 1R2Th4-0000Zq-Ot for bug-coreutils@HIDDEN; Sat, 10 Sep 2011 15:58:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <jim@HIDDEN>) id 1R2Th4-0000Zj-Hu for bug-coreutils@HIDDEN; Sat, 10 Sep 2011 15:58:26 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8AJwOxH028372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 10 Sep 2011 15:58:24 -0400 Received: from mx.meyering.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8AJwNCT011625; Sat, 10 Sep 2011 15:58:23 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id DD3A46004E; Sat, 10 Sep 2011 21:58:22 +0200 (CEST) From: Jim Meyering <jim@HIDDEN> To: devel@HIDDEN Subject: rm --no-traverse-mount-points [Re: stop rm at same-dev bind mounts In-Reply-To: <CAGZbLYk9AiAs1N68uRu6+mcEpunppPYDXyUX4Lo4_SW1Tmj2Sw@HIDDEN> (Thomas Moschny's message of "Sat, 10 Sep 2011 15:35:40 +0200") References: <CAGZbLYk9AiAs1N68uRu6+mcEpunppPYDXyUX4Lo4_SW1Tmj2Sw@HIDDEN> Date: Sat, 10 Sep 2011 21:58:22 +0200 Message-ID: <87mxec9nkx.fsf@HIDDEN> Lines: 42 MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -8.5 (--------) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -8.4 (--------) Thomas Moschny wrote: > having a rm command accidentally removing 3/4 of my system yesterday, > I am starting to wonder whether it is possible to have rm reliably > stop at bind mounts. I know there is a --one-file-system option, but > it is not working when the bind mount points to the same device: > > % cd /tmp > % mkdir -p a/b c/d ; touch c/d/file ; mount --bind c a/b > % find a > a > a/b > a/b/d > a/b/d/file > % rm -rf --one-file-system a > rm: cannot remove `a/b': Device or resource busy > % find a > a > a/b > > `file' has been removed. Imho the name of the --one-file-system option > is misleading as it only compares st_dev fields. Thanks for the example, but I don't see how that option name is misleading. A "file system" is the thing you create with "mkfs". Even though normally there is only one mount point per file system, the fact that with bind mounts there can be many doesn't change the name of the thing occupying the underlying device: a file system. I think you want a new option, say --no-traverse-mount-points. > Besides filing a > bug/enhancement ticket for coreutils, does someone know a reliable way > to stop rm in such cases? It would tell rm -r not to cross any mount point. Rm would have to be able to read at start-up the set of all mount points, or maybe only the mount points for a given device the first time a new device is encountered. Then, it could easily and efficiently test whether each directory processed is in that set. I've Cc'd bug-coreutils, so this message will create a ticket in the issue tracker: http://debbugs.gnu.org/coreutils.
Jim Meyering <jim@HIDDEN>
:bug-coreutils@HIDDEN
.
Full text available.owner <at> debbugs.gnu.org, bug-coreutils@HIDDEN
:bug#9472
; Package coreutils
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.