From owner-freebsd-rc@FreeBSD.ORG Tue Oct 10 10:40:27 2006 Return-Path: X-Original-To: freebsd-rc@hub.freebsd.org Delivered-To: freebsd-rc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9531C16A407 for ; Tue, 10 Oct 2006 10:40:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F7B643D53 for ; Tue, 10 Oct 2006 10:40:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9AAeQim012241 for ; Tue, 10 Oct 2006 10:40:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9AAeQgM012240; Tue, 10 Oct 2006 10:40:26 GMT (envelope-from gnats) Date: Tue, 10 Oct 2006 10:40:26 GMT Message-Id: <200610101040.k9AAeQgM012240@freefall.freebsd.org> To: freebsd-rc@FreeBSD.org From: Yar Tikhiy Cc: Subject: Re: bin/104044: [patch] rc.d/cleartmp works incorrectly X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Yar Tikhiy List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Oct 2006 10:40:27 -0000 The following reply was made to PR bin/104044; it has been noted by GNATS. From: Yar Tikhiy To: Andrey Simonenko Cc: Florent Thoumie , bug-followup@freebsd.org Subject: Re: bin/104044: [patch] rc.d/cleartmp works incorrectly Date: Tue, 10 Oct 2006 14:34:43 +0400 On Tue, Oct 10, 2006 at 11:26:38AM +0300, Andrey Simonenko wrote: > Another updated version: > > 1. Everything, what belongs to _start method, was moved to > cleartmp_start(). Thanks! > 2. Ignore error code from rm and always run find, that is > use "rm ... ; find ..." instead of "rm ... && find ...": > one can create many files with long names and rm will not > be called because of "Argument list too long" error, so > find should do all of the work. By the way, did you consider omitting the first rm at all and just using "find ... -print0 | xargs -0 rm -rf" ? The first rm can be an optimization as long as we use find with -exec. OTOH, xargs -0 would buy us the same performance and robustness without hacks. Both find and xargs should be available to cleartmp. Here's the code. Note "type -d" omitted. if checkyesno ${rcvar1}; then # This is not needed with mfs /tmp, but doesn't hurt anything. echo "Clearing /tmp." find -x /tmp/. ! -name . \ ! \( -name lost+found -type d -user root \) \ ! \( \( -name quota.user -or -name quota.group \) \ -type f -user root \) \ -prune -print0 | xargs -0 rm -rf elif ... Another thought of mine was that cleartmp wouldn't handle files with an immutable flag set. Fortunately, rm -f appears to take care of files with uchg while those with schg on them should be left alone. So flags aren't an issue. -- Yar