From owner-cvs-all Tue Dec 3 0:17:50 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70C7737B406 for ; Tue, 3 Dec 2002 00:17:47 -0800 (PST) Received: from mail.identd.net (matrix.identd.net [64.172.21.201]) by mx1.FreeBSD.org (Postfix) with SMTP id 3028443ECF for ; Tue, 3 Dec 2002 00:17:46 -0800 (PST) (envelope-from mtm@identd.net) Received: (qmail 69278 invoked by uid 1007); 3 Dec 2002 08:17:45 -0000 Date: Tue, 3 Dec 2002 00:17:45 -0800 From: Mike Makonnen To: Tim Robbins Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/usr.sbin/adduser Makefile adduser.8 adduser.perl adduser.sh rmuser.8 rmuser.perl rmuser.sh Message-ID: <20021203081745.GA67653@matrix.identd.net> References: <200212030541.gB35f9E0007218@repoman.freebsd.org> <20021203171341.A69835@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="i0/AhcQY5QxfSsSZ" Content-Disposition: inline In-Reply-To: <20021203171341.A69835@dilbert.robbins.dropbear.id.au> User-Agent: Mutt/1.4i X-Operating-System: FreeBSD/4.7-STABLE (i386) Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --i0/AhcQY5QxfSsSZ Content-Type: multipart/mixed; boundary="NzB8fVQJ5HfG6fxh" Content-Disposition: inline --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 03, 2002 at 05:13:41PM +1100, Tim Robbins wrote: > containing IFS characters. > filecount=3D0 > _ownedfiles=3D`find 2>/dev/null $_dir -maxdepth 1 -user $login -print` > for _file in $_ownedfiles ; do > rm -fd $_file > filecount=3D`expr $filecount + 1` > done > echo " $filecount removed." >=20 > Consider using find ... -delete instead > filecount=3D`find "$_dir" -user "$login" -delete -print | wc -l` Good catch. I've fixed it (attached diff). Thanks. >=20 > I'm also not sure what the point of -maxdepth 1 is. I think find(1) is sm= art > enough not to get stuck in symlink loops. I'm not sure myself, either (I wrote it almost 1 year ago). But, I think it was to treat subdirectories individually. Fixed that too. >=20 > Thanks for writing the replacement scripts, though. You're welcome. Cheers. --=20 Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc mtm@identd.net | Fingerprint: D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC= 68B9 --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rmuser.patch" Content-Transfer-Encoding: quoted-printable Index: usr.sbin/adduser/rmuser.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/adduser/rmuser.sh,v retrieving revision 1.1 diff -u -r1.1 rmuser.sh --- usr.sbin/adduser/rmuser.sh 2002/12/03 05:41:09 1.1 +++ usr.sbin/adduser/rmuser.sh 2002/12/03 08:13:13 @@ -33,7 +33,7 @@ CRONJOBDIR=3D"/var/cron/tabs" MAILSPOOL=3D"/var/mail" SIGKILL=3D"-KILL" -TEMPDIRS=3D"/tmp /var/tmp /var/tmp/vi.recover" +TEMPDIRS=3D"/tmp /var/tmp" THISCMD=3D`/usr/bin/basename $0` =20 # err msg @@ -57,12 +57,8 @@ continue fi echo -n "Removing files owned by ($login) in $_dir:" - filecount=3D0 - _ownedfiles=3D`find 2>/dev/null $_dir -maxdepth 1 -user $login -print` - for _file in $_ownedfiles ; do - rm -fd $_file - filecount=3D`expr $filecount + 1` - done + filecount=3D`find 2>/dev/null "$_dir" -user "$login" -delete -print | \ + wc -l | sed 's/ *//'` echo " $filecount removed." done } --NzB8fVQJ5HfG6fxh-- --i0/AhcQY5QxfSsSZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE97Gio2uHir9vMaLkRAo7cAJ4j491HL1juofrxZyW0iQS2uGDzAwCgtNej O1pslTOeJSCWD4RKub32dLU= =ZxQ5 -----END PGP SIGNATURE----- --i0/AhcQY5QxfSsSZ-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message