Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2002 00:17:45 -0800
From:      Mike Makonnen <mtm@identd.net>
To:        Tim Robbins <tjr@FreeBSD.ORG>
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>
In-Reply-To: <20021203171341.A69835@dilbert.robbins.dropbear.id.au>
References:  <200212030541.gB35f9E0007218@repoman.freebsd.org> <20021203171341.A69835@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021203081745.GA67653>