Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

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

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Apr 28, 2008, 11:56 PM

Post #1 of 3 (118 views)
Permalink
[perl #53500] op/pwent.t should use the DirectoryService on OS X

# 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[at]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.


perlbug-followup at perl

May 11, 2008, 2:40 PM

Post #2 of 3 (96 views)
Permalink
[perl #53500] op/pwent.t should use the DirectoryService on OS X [In reply to]

On Mon Apr 28 23:56:43 2008, jdb wrote:

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

I saw this in David Landgren's P5P summary, and thought maybe this was
the kind of grunt work that someone outside the usual group could
perform, and conserve the brain cycles of others for things that really
need them.

The attached universal diff is against the t/op/pwent.t that distributed
with 5.10.0, but I assume the same would go out in 5.8.9; there are only
2 lines difference from 5.8.8 to 5.10.0, dealing with changes in the
Darwin /etc/passwd format.

The complication is that dscl was not a accommodating as nidump, so
their vaguely YAML-like output had to be parsed and re-marshaled into
the expected format. The attached patch uses (and tests for) perlio. A
forked implementation could be done as well if that's desirable, but I
figured I would go with the simplest implementation first. I have NOT
run this on anything but Leopard (Mac OS X 10.5.2) on an Intel box.

Hoping this will be useful,

Tom Wyant (wyant[at]cpan.org, bitcard mailing address to the contrary
notwithstanding).
Attachments: pwent.pat (2.44 KB)


rgarciasuarez at gmail

May 18, 2008, 1:01 AM

Post #3 of 3 (80 views)
Permalink
Re: [perl #53500] op/pwent.t should use the DirectoryService on OS X [In reply to]

2008/5/11 Tom Wyant via RT <perlbug-followup[at]perl.org>:
> I saw this in David Landgren's P5P summary, and thought maybe this was
> the kind of grunt work that someone outside the usual group could
> perform, and conserve the brain cycles of others for things that really
> need them.
>
> The attached universal diff is against the t/op/pwent.t that distributed
> with 5.10.0, but I assume the same would go out in 5.8.9; there are only
> 2 lines difference from 5.8.8 to 5.10.0, dealing with changes in the
> Darwin /etc/passwd format.
>
> The complication is that dscl was not a accommodating as nidump, so
> their vaguely YAML-like output had to be parsed and re-marshaled into
> the expected format. The attached patch uses (and tests for) perlio. A
> forked implementation could be done as well if that's desirable, but I
> figured I would go with the simplest implementation first. I have NOT
> run this on anything but Leopard (Mac OS X 10.5.2) on an Intel box.
>
> Hoping this will be useful,

Hoping so too :) Thanks, applied to bleadperl as change #33850.

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.