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

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

Thread Next
Tom Wyant via RT
May 12, 2008 01:39
[perl #53500] op/pwent.t should use the DirectoryService on OS X
Message ID:
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 (, bitcard mailing address to the contrary

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About