From owner-freebsd-stable@FreeBSD.ORG Sun Jan 22 19:00:48 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4344D1065675 for ; Sun, 22 Jan 2012 19:00:48 +0000 (UTC) (envelope-from cliftonr@volcano.org) Received: from gateway11.websitewelcome.com (gateway11.websitewelcome.com [69.93.154.25]) by mx1.freebsd.org (Postfix) with ESMTP id 094008FC13 for ; Sun, 22 Jan 2012 19:00:47 +0000 (UTC) Received: by gateway11.websitewelcome.com (Postfix, from userid 5011) id 4B4D0A7548E56; Sun, 22 Jan 2012 13:00:47 -0600 (CST) Received: from gator1313.hostgator.com (gator1313.hostgator.com [174.37.241.130]) by gateway11.websitewelcome.com (Postfix) with ESMTP id 3667BA7548E36 for ; Sun, 22 Jan 2012 13:00:47 -0600 (CST) Received: from localhost ([127.0.0.1]:57954 helo=gator1313.hostgator.com) by gator1313.hostgator.com with esmtpa (Exim 4.69) (envelope-from ) id 1Rp2ek-0003DX-NB for freebsd-stable@freebsd.org; Sun, 22 Jan 2012 13:00:46 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 22 Jan 2012 13:00:46 -0600 From: cliftonr@volcano.org To: In-Reply-To: <4F0F8E6F.8000909@FreeBSD.org> References: <20120111161110.4258969c.rpclark@tds.net> <20120112200843.2a348d2f.rpclark@tds.net> <4F0F8E6F.8000909@FreeBSD.org> Message-ID: <74dee0a775b93db4771f4de96eaf86c2@volcano.org> X-Sender: cliftonr@volcano.org User-Agent: Roundcube Webmail/0.6 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator1313.hostgator.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - volcano.org X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: localhost (gator1313.hostgator.com) [127.0.0.1]:57954 X-Source-Auth: cliftonr@volcano.org X-Email-Count: 1 X-Source-Cap: Y2xpZnRvbnI7Y2xpZnRvbnI7Z2F0b3IxMzEzLmhvc3RnYXRvci5jb20= Subject: Re: GENERIC make buildkernel error / fails - posix_fadvise X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 19:00:48 -0000 On 12.01.2012 15:52, Doug Barton wrote: >>> chflags -R noschg /usr/obj/usr >>> rm -rf /usr/obj/usr > > It's much faster to do: > > /bin/rm -rf ${obj}/* 2> /dev/null || /bin/chflags -R 0 ${obj}/* && > /bin/rm -rf ${obj}/* If I could just add one thing here, for those who might be tempted to immediately cut and paste that elegant command line: Consider, how does that command evaluate if the shell variable "obj" is not set, and you're running that literal string as root? A: You will very systematically wipe your entire server, starting at the root, and doing a second pass to get any protected files you missed. I'd recommend something safer like approximately this (untested): if ["X${obj}" != "X" -a -d ${obj}]; then cd ${obj} && (rest of cmds); fi Sorry for the wasted bandwidth, for those to whom it was obvious, but anybody who has ever had to clean up after a junior admin's attempt to do something a little too clever will appreciate why I'm posting this. On the efficiency front, for the core file deletion operators, I've had good results with this trick (requires Perl and makes use of its implicit-operand idioms): find ${obj} | perl -nle unlink If rm had an option to take files from standard input, or if there's another program I'm not aware of which does this, it could serve as the right-hand side of this. -- Clifton -- Clifton Royston -- cliftonr@iandicomputing.com / cliftonr@volcano.org Custom programming, network design, systems and network consulting services