b ootclean.sh
Reply-To: James Youngman <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Resent-From: James Youngman <[EMAIL PROTECTED]>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: Miquel van Smoorenburg <[EMAIL PROTECTED]>
Resent-Date: Fri, 01 Jul 2005 04:03:05 UTC
Resent-Message-ID: <[EMAIL PROTECTED]>
Resent-Sender: [EMAIL PROTECTED]
X-Debian-PR-Message: report 316468
X-Debian-PR-Package: initscripts
X-Debian-PR-Keywords: patch
Received: via spool by [EMAIL PROTECTED] id=B.112019006811218
          (code B ref -1); Fri, 01 Jul 2005 04:03:05 UTC
Received: (at submit) by bugs.debian.org; 1 Jul 2005 03:54:28 +0000
Received: from bigben2.bytemark.co.uk [80.68.81.132] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1DoCbj-0002uZ-00; Thu, 30 Jun 2005 20:54:27 -0700
Received: from [80.68.89.77] (helo=excession.spiral-arm.org)
        by bigben2.bytemark.co.uk with esmtp (Exim 4.34)
        id 1DoCbi-0007sM-1n; Fri, 01 Jul 2005 03:54:26 +0000
Received: from orbital.spiral-arm.org (adsl-static-3-73.uklinux.net 
[62.245.38.73])
        by excession.spiral-arm.org (Postfix) with SMTP id 0A423826D;
        Fri,  1 Jul 2005 04:59:51 +0100 (BST)
Received: by orbital.spiral-arm.org (Postfix, from userid 1001)
        id 351A11406E; Fri,  1 Jul 2005 04:54:22 +0100 (BST)
Content-Type: multipart/mixed; boundary="===============0694627943=="
MIME-Version: 1.0
From: James Youngman <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
X-Mailer: reportbug 3.15
Date: Fri, 01 Jul 2005 04:54:22 +0100
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

This is a multi-part MIME message sent by reportbug.

--===============0694627943==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: initscripts
Version: 2.86.ds1-1
Severity: wishlist
Tags: patch

Currently, bootclean.sh uses both "find -exec" and "xargs" when deleting 
files and directories.  Dince findutils-4.2.3, find has had a -delete 
action which we can use to replace both of these.   In the general case
this is more secure because it's less exposed to race conditions, but
that's not relevant here.  More usefully for us, it avoids us relying on
the existence of xargs, and it's neater.   It's also more efficient but
the difference would probably be difficult to measure.   Lastly, it's
less vulnerable to problems with very deep directory hierarchies (which 
both xargs and -exec would suffer from).

I enclose a patch.


-- System Information:
Debian Release: testing/unstable
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'testing'), (500, 'stable'), (100, 
'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.10
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages initscripts depends on:
ii  coreutils           5.2.1-2              The GNU core utilities
ii  dpkg                1.13.10              Package maintenance system for Deb
ii  e2fsprogs           1.37+1.38-WIP-0620-1 ext2 file system utilities and lib
ii  libc6               2.3.2.ds1-22         GNU C Library: Shared libraries an
ii  mount               2.12p-4              Tools for mounting and manipulatin
ii  util-linux          2.12p-4              Miscellaneous system utilities

initscripts recommends no packages.

-- no debconf information

--===============0694627943==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="bootclean.noxargs.patch"

--- bootclean.sh        2005/07/01 03:39:26     1.2
+++ bootclean.sh        2005/07/01 03:42:08
@@ -56,11 +56,9 @@
        ( if cd /tmp && [ "`find . -maxdepth 0 -perm -002`" = "." ]
          then
                # First remove all old files.
-               find . -xdev -depth $TEXPR $EXCEPT \
-                               ! -type d -print0 | xargs -0r rm -f
+               find . -xdev -depth $TEXPR $EXCEPT ! -type d -delete
                # And then all empty directories.
-               find . -xdev -depth $DEXPR $EXCEPT \
-                               -type d -empty -exec rmdir \{\} \;
+               find . -xdev -depth $DEXPR $EXCEPT -type d -empty -delete
                rm -f .X*-lock
          fi
        )
@@ -74,7 +72,7 @@
        [ -f /var/lock/.clean ] && return
 
        [ "$VERBOSE" != no ] && echo -n " /var/lock"
-       ( cd /var/lock && find . ! -type d -exec rm -f -- {} \; )
+       ( cd /var/lock && find . ! -type d -delete )
        rm -f /var/lock/.clean
        set -o noclobber
        :> /var/lock/.clean
@@ -90,8 +88,7 @@
 
        [ "$VERBOSE" != no ] && echo -n " /var/run"
        ( cd /var/run && \
-               find . ! -type d ! -name utmp ! -name innd.pid \
-               -exec rm -f -- {} \; )
+               find . ! -type d ! -name utmp ! -name innd.pid -delete )
        rm -f /var/run/.clean
        set -o noclobber
        :> /var/run/.clean
@@ -100,15 +97,11 @@
 
 bootclean() {
 
-       # Only run if find and xargs are available.
+       # Only run if find is available.
        if [ ! -x /bin/find ] && [ ! -x /usr/bin/find ]
        then
                return 0
        fi
-       if [ ! -x /bin/xargs ] && [ ! -x /usr/bin/xargs ]
-       then
-               return 0
-       fi
 
        if [ -f /tmp/.clean ] && [ -f /var/run/.clean ] &&
           [ -f /var/lock/.clean ]

--===============0694627943==--


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to