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

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

Thread Next
From:
Tom Wyant via RT
Date:
May 12, 2008 01:39
Subject:
[perl #53500] op/pwent.t should use the DirectoryService on OS X
Message ID:
rt-3.6.HEAD-20841-1210542001-412.53500-15-0@perl.org
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@cpan.org, bitcard mailing address to the contrary
notwithstanding).

Thread Next


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