Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op/pwent.t should use the DirectoryService on OS X #9308

Closed
p5pRT opened this issue Apr 29, 2008 · 7 comments
Closed

op/pwent.t should use the DirectoryService on OS X #9308

p5pRT opened this issue Apr 29, 2008 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 29, 2008

Migrated from rt.perl.org#53500 (status was 'resolved')

Searchable as RT53500$

@p5pRT
Copy link
Author

p5pRT commented Apr 9, 2008

From @jandubois

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.

1 similar comment
@p5pRT
Copy link
Author

p5pRT commented Apr 29, 2008

From @jandubois

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.

@p5pRT
Copy link
Author

p5pRT commented May 11, 2008

From @trwyant

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

@p5pRT
Copy link
Author

p5pRT commented May 11, 2008

From @trwyant

pwent.pat

@p5pRT
Copy link
Author

p5pRT commented May 11, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 18, 2008

@rgs - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed May 18, 2008
@p5pRT
Copy link
Author

p5pRT commented May 18, 2008

From @rgs

2008/5/11 Tom Wyant via RT <perlbug-followup@​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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant