Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Perl 5.8.8 installation issue, Cwd test hanging, solaris 2.9

by kwaping (Priest)
on Jan 23, 2007 at 16:45 UTC ( #596122=perlquestion: print w/replies, xml ) Need Help??

kwaping has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to upgrade my perl 5.6.1 to 5.8.8 on a solaris 2.9 box. Configure went well, with no errors, as did make. However, make test is stopping during the testing of Cwd. It just sits there until I cancel it with ^C. I've tried this as different users and in different shells, with no success.

I went into the t directory and ran the specific test that's failing. Here's the output from that:
> env PERL_CORE=1 ./perl -I../lib ../ext/Cwd/t/cwd.t 1..33 ok 1 # skip no need to check for blib/ in the core ok 2 - main->can(...) ok 3 - chdir() not exported by default ok 4 - nor abs_path() ok 5 - nor fast_abs_path() ok 6 - cwd() shouldn't create spurious entries in %ENV # native pwd = '/usr/bin/pwd' ok 7 - cwd() ok 8 - getcwd() ok 9 - fastcwd() ok 10 - fastgetcwd() ok 11 ok 12 - cwd() ok 13 ok 14 - getcwd() ok 15 ok 16 - fastcwd() ok 17 ok 18 - fastgetcwd() ok 19 - Cwd::chdir() updates $ENV{PWD} #/app/ollie/downloads/perl-5.8.8/t/_ptrslt_/_path_/_to_/_a_ #/app/ollie/downloads/perl-5.8.8/t/_ptrslt_/_path_/_to_ #/app/ollie/downloads/perl-5.8.8/t/_ptrslt_/_path_ #/app/ollie/downloads/perl-5.8.8/t/_ptrslt_ #/app/ollie/downloads/perl-5.8.8/t ok 20 ok 21 ok 22 ok 23 ok 24 ok 25 - abs_path() can be invoked on a file ok 26 - fast_abs_path() can be invoked on a file ok 27 - _perl_abs_path() can be invoked on a file ok 28 - abs_path() can be invoked on a file ok 29 - fast_abs_path() can be invoked on a file ok 30 - _perl_abs_path() can be invoked on a file ^C
The gap between the output of test 30 and my ^C is very long, roughly an hour. During that time, neither the system's CPU nor RAM was taxed in the least, if that's of any use.

Here's the source of cwd.t:
#!./perl -w BEGIN { if ($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use Cwd; chdir 't'; use strict; use Config; use File::Spec; use File::Path; use lib File::Spec->catdir('t', 'lib'); use Test::More; require VMS::Filespec if $^O eq 'VMS'; my $tests = 29; # _perl_abs_path() currently only works when the directory separator # is '/', so don't test it when it won't work. my $EXTRA_ABSPATH_TESTS = ($Config{prefix} =~ m/\//) && $^O ne 'cygwin +'; $tests += 4 if $EXTRA_ABSPATH_TESTS; plan tests => $tests; SKIP: { skip "no need to check for blib/ in the core", 1 if $ENV{PERL_CORE}; like $INC{''}, qr{blib}i, "Cwd should be loaded from blib/ dur +ing testing"; } my $IsVMS = $^O eq 'VMS'; my $IsMacOS = $^O eq 'MacOS'; # check imports can_ok('main', qw(cwd getcwd fastcwd fastgetcwd)); ok( !defined(&chdir), 'chdir() not exported by default' ); ok( !defined(&abs_path), ' nor abs_path()' ); ok( !defined(&fast_abs_path), ' nor fast_abs_path()'); { my @fields = qw(PATH IFS CDPATH ENV BASH_ENV); my $before = grep exists $ENV{$_}, @fields; cwd(); my $after = grep exists $ENV{$_}, @fields; is($before, $after, "cwd() shouldn't create spurious entries in %ENV +"); } # XXX force Cwd to bootsrap its XSUBs since we have set @INC = "../lib +" # XXX and subsequent chdir()s can make them impossible to find eval { fastcwd }; # Must find an external pwd (or equivalent) command. my $pwd = $^O eq 'MSWin32' ? "cmd" : "pwd"; my $pwd_cmd = ($^O eq "NetWare") ? "cd" : ($IsMacOS) ? "pwd" : (grep { -x && -f } map { "$_/$pwd$Config{exe_ext}" } split m/$Config{path_sep}/, $ENV{PATH})[0]; $pwd_cmd = 'SHOW DEFAULT' if $IsVMS; if ($^O eq 'MSWin32') { $pwd_cmd =~ s,/,\\,g; $pwd_cmd = "$pwd_cmd /c cd"; } $pwd_cmd =~ s=\\=/=g if ($^O eq 'dos'); SKIP: { skip "No native pwd command found to test against", 4 unless $pwd_ +cmd; print "# native pwd = '$pwd_cmd'\n"; local @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; my ($pwd_cmd_untainted) = $pwd_cmd =~ /^(.+)$/; # Untaint. chomp(my $start = `$pwd_cmd_untainted`); # Win32's cd returns native C:\ style $start =~ s,\\,/,g if ($^O eq 'MSWin32' || $^O eq "NetWare"); # DCL SHOW DEFAULT has leading spaces $start =~ s/^\s+// if $IsVMS; SKIP: { skip("'$pwd_cmd' failed, nothing to test against", 4) if $?; skip("/afs seen, paths unlikely to match", 4) if $start =~ m|/ +afs/|; # Darwin's getcwd(3) (which Cwd.xs:bsd_realpath() uses which # uses) has some magic related to the PWD # environment variable: if PWD is set to a directory that # looks about right (guess: has the same (dev,ino) as the '.'?), # the PWD is returned. However, if that path contains # symlinks, the path will not be equal to the one returned by # /bin/pwd (which probably uses the usual walking upwards in # the path -trick). This situation is easy to reproduce since # /tmp is a symlink to /private/tmp. Therefore we invalidate # the PWD to force getcwd(3) to (re)compute the cwd in full. # Admittedly fixing this in the Cwd module would be better # long-term solution but deleting $ENV{PWD} should not be # done light-heartedly. --jhi delete $ENV{PWD} if $^O eq 'darwin'; my $cwd = cwd; my $getcwd = getcwd; my $fastcwd = fastcwd; my $fastgetcwd = fastgetcwd; is($cwd, $start, 'cwd()'); is($getcwd, $start, 'getcwd()'); is($fastcwd, $start, 'fastcwd()'); is($fastgetcwd, $start, 'fastgetcwd()'); } } my @test_dirs = qw{_ptrslt_ _path_ _to_ _a_ _dir_}; my $Test_Dir = File::Spec->catdir(@test_dirs); mkpath([$Test_Dir], 0, 0777); Cwd::chdir $Test_Dir; foreach my $func (qw(cwd getcwd fastcwd fastgetcwd)) { my $result = eval "$func()"; is $@, ''; dir_ends_with( $result, $Test_Dir, "$func()" ); } # Cwd::chdir should also update $ENV{PWD} dir_ends_with( $ENV{PWD}, $Test_Dir, 'Cwd::chdir() updates $ENV{PWD}' +); my $updir = File::Spec->updir; Cwd::chdir $updir; print "#$ENV{PWD}\n"; Cwd::chdir $updir; print "#$ENV{PWD}\n"; Cwd::chdir $updir; print "#$ENV{PWD}\n"; Cwd::chdir $updir; print "#$ENV{PWD}\n"; Cwd::chdir $updir; print "#$ENV{PWD}\n"; rmtree($test_dirs[0], 0, 0); { my $check = ($IsVMS ? qr|\b((?i)t)\]$| : $IsMacOS ? qr|\bt:$| : qr|\bt$| ); like($ENV{PWD}, $check); } { # Make sure abs_path() doesn't trample $ENV{PWD} my $start_pwd = $ENV{PWD}; mkpath([$Test_Dir], 0, 0777); Cwd::abs_path($Test_Dir); is $ENV{PWD}, $start_pwd; rmtree($test_dirs[0], 0, 0); } SKIP: { skip "no symlinks on this platform", 2+$EXTRA_ABSPATH_TESTS unless + $Config{d_symlink}; mkpath([$Test_Dir], 0, 0777); symlink $Test_Dir, "linktest"; my $abs_path = Cwd::abs_path("linktest"); my $fast_abs_path = Cwd::fast_abs_path("linktest"); my $want = File::Spec->catdir("t", $Test_Dir); like($abs_path, qr|$want$|); like($fast_abs_path, qr|$want$|); like(Cwd::_perl_abs_path("linktest"), qr|$want$|) if $EXTRA_ABSPAT +H_TESTS; rmtree($test_dirs[0], 0, 0); unlink "linktest"; } if ($ENV{PERL_CORE}) { chdir '../ext/Cwd/t'; unshift @INC, '../../../lib'; } # Make sure we can run abs_path() on files, not just directories my $path = 'cwd.t'; path_ends_with(Cwd::abs_path($path), 'cwd.t', 'abs_path() can be invok +ed on a file'); path_ends_with(Cwd::fast_abs_path($path), 'cwd.t', 'fast_abs_path() ca +n be invoked on a file'); path_ends_with(Cwd::_perl_abs_path($path), 'cwd.t', '_perl_abs_path() +can be invoked on a file') if $EXTRA_ABSPATH_TESTS; $path = File::Spec->catfile(File::Spec->updir, 't', $path); path_ends_with(Cwd::abs_path($path), 'cwd.t', 'abs_path() can be invok +ed on a file'); path_ends_with(Cwd::fast_abs_path($path), 'cwd.t', 'fast_abs_path() ca +n be invoked on a file'); path_ends_with(Cwd::_perl_abs_path($path), 'cwd.t', '_perl_abs_path() +can be invoked on a file') if $EXTRA_ABSPATH_TESTS; SKIP: { my $file; { my $root = Cwd::abs_path(File::Spec->rootdir); # Add drive lett +er? local *FH; opendir FH, $root or skip("Can't opendir($root): $!", 2+$EXTRA_ABS +PATH_TESTS); ($file) = grep {-f $_ and not -l $_} map File::Spec->catfile($root +, $_), readdir FH; closedir FH; } skip "No plain file in root directory to test with", 2+$EXTRA_ABSPAT +H_TESTS unless $file; $file = VMS::Filespec::rmsexpand($file) if $^O eq 'VMS'; is Cwd::abs_path($file), $file, 'abs_path() works on files in the ro +ot directory'; is Cwd::fast_abs_path($file), $file, 'fast_abs_path() works on files + in the root directory'; is Cwd::_perl_abs_path($file), $file, '_perl_abs_path() works on fil +es in the root directory' if $EXTRA_ABSPATH_TESTS; } ############################################# # These routines give us sort of a poor-man's cross-platform # directory or path comparison capability. sub bracketed_form_dir { return join '', map "[$_]", grep length, File::Spec->splitdir(File::Spec->canonpath( shift() ) +); } sub dir_ends_with { my ($dir, $expect) = (shift, shift); my $bracketed_expect = quotemeta bracketed_form_dir($expect); like( bracketed_form_dir($dir), qr|$bracketed_expect$|i, (@_ ? shift + : ()) ); } sub bracketed_form_path { return join '', map "[$_]", grep length, File::Spec->splitpath(File::Spec->canonpath( shift() +)); } sub path_ends_with { my ($dir, $expect) = (shift, shift); my $bracketed_expect = quotemeta bracketed_form_path($expect); like( bracketed_form_path($dir), qr|$bracketed_expect$|i, (@_ ? shif +t : ()) ); }
Here's my perl -Ilib -V output:
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=solaris, osvers=2.9, archname=sun4-solaris uname='sunos elctrbz72 5.9 generic_112233-11 sun4u sparc sunw,sun- +fire-v210 ' config_args='-Dprefix=/usr -Dversiononly -Dextras=Bundle::LWP Bund +le::DBI DBD::Oracle' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FIL +E_OFFSET_BITS=64', optimize='-O', cppflags='-I/usr/local/include' ccversion='Sun C 5.8 2005/10/13', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/lib -L/usr/ccs/lib -L/app/bin/SUNWspro/ +prod/lib/v8plus -L/app/bin/SUNWspro/prod/lib -L/lib -L/usr/local/lib +' libpth=/opt/sfw/lib /usr/lib /usr/ccs/lib /app/bin/SUNWspro/prod/l +ib/v8plus /app/bin/SUNWspro/prod/lib /lib /usr/local/lib libs=-lsocket -lnsl -ldb -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib -L/app +/bin/SUNWspro/prod/lib/v8plus -L/app/bin/SUNWspro/prod/lib -L/lib -L/ +usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under solaris Compiled at Jan 22 2007 11:37:14 %ENV: PERL5LIB="/webfiles/localmods" @INC: lib /webfiles/localmods /usr/lib/perl5/5.8.8/sun4-solaris /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/sun4-solaris /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /webfiles/localmods .
Any hints or suggestions would be greatly appreciated!

It's all fine and dandy until someone has to look at the code.

Replies are listed 'Best First'.
Re: Perl 5.8.8 installation issue, Cwd test hanging, solaris 2.9
by diotalevi (Canon) on Jan 23, 2007 at 16:54 UTC

    You can run tests under the debugger to step through them to find the bad bits. perl -Mblib -d t/cwd.t

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Actually, you can debug from the make file:

      make testdb TEST_FILE=t/cwd.t

      Hazah! I'm Employed!

      Thanks for the debugger pointer. Using it, I discovered that the problem lies on line 208 of cwd.t.
      # this is the line I removed # ($file) = grep {-f $_ and not -l $_} map File::Spec->catfile($roo +t, $_), readdir FH; # and replaced with this foreach my $x (readdir(FH)) { my $y = File::Spec->catfile($root, $x); if (-f $y && ! -l $y) { $file = $y; last; } }
      It appears there was somthing in my root directory that wasn't to the code's liking, so I just took the first successful hit of the file test operators and bailed out of the loop. I'm fairly certain I didn't compromise the accuracy of the test, but please let me know if you see a problem with what I did.

      It's all fine and dandy until someone has to look at the code.

        Perhaps you have a stale NFS mount or something unreadable on your disk.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Re: Perl 5.8.8 installation issue, Cwd test hanging, solaris 2.9
by Tux (Canon) on Jan 23, 2007 at 19:00 UTC
    Yet even simpler,
    /app/ollie/downloads/perl-5.8.8 > cd t /app/ollie/downloads/perl-5.8.8/t > ./TEST ../ext/Cwd/t/cwd.t
    But that is not the question at hand. Why does it hang in Slowaris?
    One thing I don't like is the /webfiles/localmods. If that is AFS, NFS, or Samba share, there might be some trouble ahead.
    First try to run with $PERL5LIB unset. It is NOT a good idea to run the CORE test with $PERL5LIB set to something outside of the core.

    Enjoy, Have FUN! H.Merijn
      Thanks for your suggestion, I'll see what I can do along those lines. While /webfiles/localmods is my $PERL5LIB, I've also compiled it as an extra @INC directory during configuration. I'll try recompiling without it and see if that changes anything.

      Update: For the record, that didn't change anything.

      It's all fine and dandy until someone has to look at the code.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://596122]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2023-05-30 14:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found