develooper Front page | perl.perl5.porters | Postings from April 2008

[perl #53500] op/pwent.t should use the DirectoryService on OS X

From:
Jan Dubois
Date:
April 29, 2008 14:12
Subject:
[perl #53500] op/pwent.t should use the DirectoryService on OS X
Message ID:
rt-3.6.HEAD-3343-1209452203-310.53500-75-0@perl.org
# New Ticket Created by  Jan Dubois 
# Please include the string:  [perl #53500]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=53500 >


I did look at op/pwent.t today (I'm running a subset of 5.6.1 tests
against 5.8.9-tobe), and I noticed that at least this checkin message
is somewhat misleading:

> Change 32200 by rgs@stcosmo on 2007/10/29 10:49:13
> 
> 	Leopard has more standard /etc/passwd files than previous
> 	versions of darwin. Thanks to David Morel for testing.

The /etc/passwd file always had the standard format on OS X, but
op/pwent.t was using /usr/bin/nidump to get at the "real" passwd
information (the /etc/passwd file is only used when you run in single-
user mode, and doesn't include all the local users you add via the
UI). Since nidump is no longer included in 10.5, the test is falling
back to reading /etc/passwd which is in the same format as it is on
other systems.

Since there are more than 25 entries in /etc/passwd on OS X 10.5, these
entries will match the information returned by the DirectoryService and
the test continues to pass. It is not really testing if getpwent() can
retrieve all the actual users on the system though.

I think a proper replacement for reading `nidump passwd .` would be to
parse the output of `dscl . -readall /users`. I won't have time to do
this, but I thought I would at least post the results of my
investigation.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About