From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q39xv-0007nz-VA for garchives@archives.gentoo.org; Fri, 25 Mar 2011 16:34:24 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8AF181C051; Fri, 25 Mar 2011 16:33:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 431C01C051 for ; Fri, 25 Mar 2011 16:33:46 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 95BB01B400F for ; Fri, 25 Mar 2011 16:33:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id EF61A8006A for ; Fri, 25 Mar 2011 16:33:44 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <7c1a2defb6fdec4190a2256bd023857e30ecb7a7.williamH@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/bootmisc.in X-VCS-Directories: init.d/ X-VCS-Committer: williamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 7c1a2defb6fdec4190a2256bd023857e30ecb7a7 Date: Fri, 25 Mar 2011 16:33:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 9e93f3716432f74de9a7ca7ec1a8cc2a commit: 7c1a2defb6fdec4190a2256bd023857e30ecb7a7 Author: Mike Frysinger gentoo org> AuthorDate: Wed Mar 23 18:42:42 2011 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Mar 25 16:25:25 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D7c1a2def bootmisc: clean up tmpdir cleaning Make sure that the `cd` into the $dir actually happened. This we don't have to worry about relative paths deleting stuff it shouldn't. This step shouldn't fail, but who knows, and better to be sane than to wipe out someone's valuables. When wiping, automatically fall back to a dedicated `find` if the initial `rm` failed on us. This should help with the speed issues related to the later `find`. Have the later find only search the top level allowing `rm` to walk the directory contents. This means that -xdev no longer applies, but since the earlier `rm` wasn't doing -xdev either and no one has complained thus far, let's assume it isn't an issue. Also convert to the -exec...+ form so that we don't have to worry about long argument lists, and add -- to the `rm` that was previously missing. In practice, this shouldn't matter as we've already deleted all those files, but better safe than sorry. When cleaning, since we've already done a `cd` into the $dir, no point in prefixing all the paths with $dir too. Go with the relative loving. Signed-off-by: Mike Frysinger gentoo.org> X-Gentoo-Bug: 359831 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=3D359831 --- init.d/bootmisc.in | 43 ++++++++++++++++++++----------------------- 1 files changed, 20 insertions(+), 23 deletions(-) diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index 320e7e8..37f187b 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -26,14 +26,15 @@ cleanup_tmp_dir() fi dir_writeable "$dir" || return 1 chmod a+rwt "$dir" 2> /dev/null - cd "$dir" + cd "$dir" || return 1 if yesno $wipe_tmp; then ebegin "Wiping $dir directory" - local startopts=3D"-x . -depth" - [ "$RC_UNAME" =3D Linux ] && startopts=3D". -xdev -depth" =20 - # Faster than find - rm -rf -- [^ajlq\.]* + # Faster than raw find + if ! rm -rf -- [^ajlq\.]* 2>/dev/null ; then + # Blah, too many files + find . -maxdepth 1 -name '[^ajlq\.]*' -exec rm -rf -- {} + + fi =20 # pam_mktemp creates a .private directory within which # each user gets a private directory with immutable @@ -41,27 +42,23 @@ cleanup_tmp_dir() # remove it. [ -d /tmp/.private ] && chattr -R -a /tmp/.private 2> /dev/null =20 - find $startopts ! -name . \ - ! -path "./lost+found" \ - ! -path "./lost+found/*" \ - ! -path "./quota.user" \ - ! -path "./quota.user/*" \ - ! -path "./aquota.user" \ - ! -path "./aquota.user/*" \ - ! -path "./quota.group" \ - ! -path "./quota.group/*" \ - ! -path "./aquota.group" \ - ! -path "./aquota.group/*" \ - ! -path "./journal" \ - ! -path "./journal/*" \ - -exec rm -rf {} \; + # Prune the paths that are left + find . -maxdepth 1 \ + ! -name . \ + ! -name lost+found \ + ! -name quota.user \ + ! -name aquota.user \ + ! -name quota.group \ + ! -name aquota.group \ + ! -name journal \ + -exec rm -rf -- {} + eend 0 else ebegin "Cleaning $dir directory" - rm -rf -- "$dir"/.X*-lock "$dir"/esrv* "$dir"/kio* \ - "$dir"/jpsock.* "$dir"/.fam* "$dir"/.esd* \ - "$dir"/orbit-* "$dir"/ssh-* "$dir"/ksocket-* \ - "$dir"/.*-unix + rm -rf -- .X*-lock esrv* kio* \ + jpsock.* .fam* .esd* \ + orbit-* ssh-* ksocket-* \ + .*-unix eend 0 fi }