'ls -n' opens password file for reading

Guy Harris guy at auspex.auspex.com
Fri May 19 02:35:58 AEST 1989


>Two possible improvements:
>	1) ls currently (svr3) remembers the last uid & gid
>	searched for an SUCCESFULLY found in the /etc/(passwd|group)
>	file.  This "buffer :)" should be enlarged and also include
>	unfound ids.

The SunOS S5 "ls" ("/usr/5bin/ls"), as I remember, has the same UID/GID
lookup cache as does the SunOS 4BSD "ls" ("/usr/bin/ls", or "/bin/ls" on
older versions), which is derived from the 4.xBSD version, and which
handles multiple UIDs and GIDs.  The BSD version doesn't handle missing
IDs, though; I don't remember whether the SunOS one does.

(Oh, and while you're doing this, fix it to use "getpwuid" and
"getgrgid", as mentioned in a previous article....)

>	2) This would elliviate the need for a larger buffer;
>	use some kind of database system to speed up access to
>	the password file (I belive some BSD systems may do this)

Yes, 4.3BSD uses an "ndbm" index to the password file in "getpw*"; since
their "ls" uses "getpwuid", it picks up the improvement automatically.



More information about the Comp.bugs.sys5 mailing list