In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/437634214c32c38d6863be2710942f00fb607f6f?hp=92e82afa16f5f1aa1b3e163f6d4656d14c44a4d2>
- Log ----------------------------------------------------------------- commit 437634214c32c38d6863be2710942f00fb607f6f Author: Nicholas Clark <[email protected]> Date: Fri Mar 11 15:00:31 2011 +0000 Move pwent.t's test for NIS+ earlier, before the "fallback" of /etc/passwd This seems a more logical place for it, on the assumptions that a: only 1 of the 4 programs tried will produce results b: Reading from /etc/passwd is intended as a fallback if none produce results. M t/op/pwent.t commit 461bf37a2f9aa3ab3d7ec74d49a032a2a5173ab5 Author: Nicholas Clark <[email protected]> Date: Fri Mar 11 14:52:44 2011 +0000 In t/op/pwent.t, create try_prog() for the common 'try this command' logic. Also refactor the clearing of $reason, without changing the behaviour of when it is cleared (which is slightly less than logical.) M t/op/pwent.t commit c3cf41ec234f6d938cb05ecac21c0ca7515d1d14 Author: Nicholas Clark <[email protected]> Date: Sat Mar 12 16:32:08 2011 +0000 Add PERL_PRESERVE_IVUV to non_bincompat_options. It's actually the default, but as all the C code is conditionally (not) compiled on the basis of that pre-processor macro, seems that it is the one that needs to be reported. M perl.c ----------------------------------------------------------------------- Summary of changes: perl.c | 3 +++ t/op/pwent.t | 55 ++++++++++++++++++++----------------------------------- 2 files changed, 23 insertions(+), 35 deletions(-) diff --git a/perl.c b/perl.c index 5efa8e5..bfa4fe8 100644 --- a/perl.c +++ b/perl.c @@ -1691,6 +1691,9 @@ S_Internals_V(pTHX_ CV *cv) # ifdef PERL_MEM_LOG_NOIMPL " PERL_MEM_LOG_NOIMPL" # endif +# ifdef PERL_PRESERVE_IVUV + " PERL_PRESERVE_IVUV" +# endif # ifdef PERL_USE_DEVEL " PERL_USE_DEVEL" # endif diff --git a/t/op/pwent.t b/t/op/pwent.t index 9653c6b..d061d77 100644 --- a/t/op/pwent.t +++ b/t/op/pwent.t @@ -1,5 +1,16 @@ #!./perl +sub try_prog { + my ($where, $args, @pathnames) = @_; + foreach my $prog (@pathnames) { + next unless -x $prog; + next unless open PW, '-|', "$prog $args 2>/dev/null"; + next unless defined <PW>; + return $where; + } + return; +} + BEGIN { chdir 't' if -d 't'; @INC = '../lib'; @@ -17,29 +28,15 @@ BEGIN { $reason = 'no /etc/passwd file'; } - if (not defined $where) { # Try NIS. - foreach my $ypcat (qw(/usr/bin/ypcat /bin/ypcat /etc/ypcat)) { - if (-x $ypcat && - open(PW, "$ypcat passwd 2>/dev/null |") && - defined(<PW>)) { - $where = "NIS passwd"; - undef $reason; - last; - } - } - } + # Try NIS. + $where = try_prog('NIS passwd', 'passwd', + qw(/usr/bin/ypcat /bin/ypcat /etc/ypcat)); - if (not defined $where) { # Try NetInfo. - foreach my $nidump (qw(/usr/bin/nidump)) { - if (-x $nidump && - open(PW, "$nidump passwd . 2>/dev/null |") && - defined(<PW>)) { - $where = "NetInfo passwd"; - undef $reason; - last; - } - } - } + # Try NetInfo. + $where //= try_prog('NetInfo passwd', 'passwd .', '/usr/bin/nidump'); + + # Try NIS+. + $where //= try_prog('NIS+', 'passwd.org_dir', '/bin/niscat'); if (not defined $where && # Try dscl $Config{useperlio} eq 'define') { # need perlio @@ -100,7 +97,6 @@ BEGIN { @rec and $data .= join (':', @rec) . "\n"; if (open (PW, '<', \$data)) { $where = "dscl . -readall /Users"; - undef $reason; last; } } @@ -110,21 +106,10 @@ BEGIN { my $PW = "/etc/passwd"; if (-f $PW && open(PW, $PW) && defined(<PW>)) { $where = $PW; - undef $reason; } } - if (not defined $where) { # Try NIS+ - foreach my $niscat (qw(/bin/niscat)) { - if (-x $niscat && - open(PW, "$niscat passwd.org_dir 2>/dev/null |") && - defined(<PW>)) { - $where = "NIS+ $niscat passwd.org_dir"; - undef $reason; - last; - } - } - } + undef $reason if defined $where; if ($reason) { # Give up. print "1..0 # Skip: $reason\n"; -- Perl5 Master Repository
