From owner-cvs-src@FreeBSD.ORG Tue Oct 17 17:31:38 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1CA916A47C; Tue, 17 Oct 2006 17:31:38 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3C1243D60; Tue, 17 Oct 2006 17:31:36 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.3) with ESMTP id k9HHVYmL075216; Tue, 17 Oct 2006 21:31:35 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.3/Submit) id k9HHVY2c075215; Tue, 17 Oct 2006 21:31:34 +0400 (MSD) (envelope-from yar) Date: Tue, 17 Oct 2006 21:31:33 +0400 From: Yar Tikhiy To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Message-ID: <20061017173133.GD70184@comp.chem.msu.su> References: <200610161301.k9GD1j0C074012@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200610161301.k9GD1j0C074012@repoman.freebsd.org> User-Agent: Mutt/1.5.9i Cc: Maxime Henrion , Andrzej Tobola Subject: Re: cvs commit: src/etc/rc.d cleartmp X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2006 17:31:39 -0000 On Mon, Oct 16, 2006 at 01:01:45PM +0000, Yar Tikhiy wrote: > yar 2006-10-16 13:01:45 UTC > > FreeBSD src repository > > Modified files: > etc/rc.d cleartmp > Log: > Improve cleartmp in a number of aspects: > > + Use rc.subr(8) features properly. > + Do the whole job of obliterating /tmp contents in find(1). > + Leave lost+found and quota.{user,group} in /tmp only if root-owned. > + Make the overall structure clearer by first removing the X dirs > (perhaps along with the rest of /tmp) and then re-creating them. > + Use "find -exec rm -rf {} +" for efficiency: each rm instance gets > a chance to kill as much files in /tmp as ARG_MAX permits. I was asked a few times why "-prune -exec rm -rf" had been chosen over "-delete". My initial reason was that -delete would keep bogus lost+found and quota.{user,group} entries found in subdirs of /tmp. Well, on second thought, the find command line can be tweaked so that -delete works as wanted. E.g.: cd /tmp && find -x . ! -name . \ ! \( -path ./lost+found -type d -user root \) \ ! \( \( -path ./quota.user -or -path ./quota.group \) \ -type f -user root \) \ -delete Note using -path in place of -name. However, it has recently been found that our fts(3) implementation is unable to handle very deep trees -- see PR bin/104458. While the bug hits both rm and find, rm has a better chance to recover from it and gain the ability to remove virtually unlimited trees while find is doomed to retain much more inherent limitations due to its complex nature. Therefore I'm inclined to keep "-prune -exec rm -rf" as a more robust approach, at least potentially. So find has only to skim over /tmp while descending to its deeps is left to rm. > PR: bin/104044 > Submitted by: Andrey Simonenko > Hacked by: yar > MFC after: 1 month > > Revision Changes Path > 1.18 +37 -36 src/etc/rc.d/cleartmp -- Yar