From owner-freebsd-questions@FreeBSD.ORG Wed Mar 26 00:13:11 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 14FF437B404 for ; Wed, 26 Mar 2003 00:13:11 -0800 (PST) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id A87A843F3F for ; Wed, 26 Mar 2003 00:13:09 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) h2Q8D7pQ006360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 26 Mar 2003 08:13:07 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)h2Q8D7Lu006359 for questions@freebsd.org; Wed, 26 Mar 2003 08:13:07 GMT Date: Wed, 26 Mar 2003 08:13:07 +0000 From: Matthew Seaman To: questions@freebsd.org Message-ID: <20030326081307.GC5568@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , questions@freebsd.org References: <20030326072922.GA5568@happy-idiot-talk.infracaninophi> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kVXhAStRUZ/+rrGn" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-39.0 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Subject: Re: File owner name not updated. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Mar 2003 08:13:12 -0000 X-List-Received-Date: Wed, 26 Mar 2003 08:13:12 -0000 --kVXhAStRUZ/+rrGn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 25, 2003 at 11:44:52PM -0800, Kevin Stevens wrote: >=20 > On Tuesday, Mar 25, 2003, at 23:29 US/Pacific, Matthew Seaman wrote: >=20 > >Two things occur to me: > > > > i) Did root use vipw(8) to edit the passwd database, or otherwise > > run: > > > > # cap_mkdb /etc/master.passwd > > > > when the UID was changed? It's the value in the hashed > > database cap_mkdb(1) builds that is used by the system. > > Updating that should have instantaneous effect. >=20 > Just tried running that after creating a dummy user and changing his=20 > uid from 1005 to 1010. No change. >=20 > >The problem is not with the ls(1) command per se. It's the underlying > >system library functions such as getpwuid(3) which do the translation > >between numeric UIDs and usernames that are the seat of the problem. > >You can see that by running some other command that uses getpwuid(3),=20 > >eg: > > > > % perl -e 'print scalar getpwuid(503), "\n";' >=20 > bash-2.05b# perl -e 'print scalar getpwuid(1010), "\n";' > fred > bash-2.05b# perl -e 'print scalar getpwuid(1005), "\n";' > fred >=20 > bash-2.05b# grep fred /etc/master.passwd > fred:*:1010:1005:User &:/home/fred:/bin/sh Interesting. I can reproduce exactly what you're seeing: % sudo pw user add -n fred -u 1010 -m=20 % id -P fred fred:*:1010:1010::0:0:User &:/home/fred:/bin/sh % ls -lad /home/fred=20 drwxr-xr-x 2 fred fred 512 Mar 26 08:01 /home/fred/ % sudo pw user mod fred -u 1005 % id -P fred=20 fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh % ls -lad /home/fred=20 drwxr-xr-x 2 fred fred 512 Mar 26 08:01 /home/fred/ % id -P 1005 fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh % id -P 1010 fred:*:1010:1010::0:0:User &:/home/fred:/bin/sh % sudo grep 1010 /etc/master.passwd=20 fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh However, running pwd_mkdb(8) seems to cure the problem very effectively: % sudo pwd_mkdb /etc/master.passwd=20 % id -P fred=20 fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh % id -P 1005=20 fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh % id -P 1010 id: 1010: no such user % ls -lad /home/fred drwxr-xr-x 2 1010 fred 512 Mar 26 08:01 /home/fred/ =20 Looks like a bug to me... Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --kVXhAStRUZ/+rrGn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+gWETdtESqEQa7a0RAvGPAJ9nmy/bGXgr7Xc5BXRpf52CuTsq1gCggbVd 56SxzJsjS0XShSc4CCVYT8g= =rO/B -----END PGP SIGNATURE----- --kVXhAStRUZ/+rrGn--