Search code examples
perlmakefilecompilationexecsymlink

perl compilation: 'Too many levels of symbolic links'


In Linux, installation of perl is failing while running make test command

t/op/exec ...................................................... # Failed test 17 - at op/exec.t line 114
# $! eq 40, 'Too many levels of symbolic links'
FAILED at test 17

Error is not indicating for which symbolic link it is failing.

Steps Followed:

- Download perl archive from https://www.cpan.org/src/ 

- [user@hostname perl-5.28.3]$  tar -xvzf perl-5.28.3.tar.gz

- [user@hostname perl-5.28.3]$  cd perl-5.28.3

- [user@hostname perl-5.28.3]$  ./Configure -des -Dinstallprefix=<installation directory>

- [user@hostname perl-5.28.3]$  make

- [user@hostname perl-5.28.3]$  make test

Failed 2 tests out of 2464, 99.92% okay.
        ../cpan/Time-Local/t/Local.t
        op/exec.t
Elapsed: 1317 sec
u=12.87  s=34.02  cu=548.85  cs=488.76  scripts=2464  tests=1158447
make: *** [test] Error 1



[user@hostname perl-5.28.3]$  t/TEST op/exec.t
t/op/exec ... # Failed test 17 - at op/exec.t line 114
# $! eq 40, 'Too many levels of symbolic links'
FAILED at test 17
Failed 1 test out of 1, 0.00% okay.
        op/exec.t

Verified same behavior is happening for other perl version also, this is indicating some issue with my installation environment.

Any pointer can be helpful.


Solution

  • Thank you for the pointer @choroba.

    Following was the root cause.

    In <perl-5.28.3>/t/op/exec.t file, we find the following around line 114:

    $rc = system { "lskdfj" } "lskdfj";
    unless( ok($rc == 255 << 8 or $rc == -1 or $rc == 256 or $rc == 512) ) {
        print "# \$rc == $rc\n";
    }
    
    unless ( ok( $! == 2  or  $! =~ /\bno\b.*\bfile/i or  
                 $! == 13 or  $! =~ /permission denied/i or
                 $! == 22 or  $! =~ /invalid argument/i  ) ) {
        diag sprintf "\$! eq %d, '%s'\n", $!, $!;
    }
    

    In my environment PATH env variable value was

    [user@hostname perl-5.28.3]$ echo $PATH
    /bin:/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:/usr/local/bin:/usr/local/ade/bin
    

    Within this PATH, for following paths ls attempt is throwing error 'Too many levels of symbolic links'

    [user@hostname perl-5.28.3]$ ls -i  /usr/local/bin /usr/local/ade/bin
    ls: cannot access /usr/local/bin: Too many levels of symbolic links
    ls: cannot access /usr/local/ade/bin: Too many levels of symbolic links
        
    [user@hostname perl-5.28.3]$ ls -ltr /usr/local
    lrwxrwxrwx. 1 root root   20 Mar 30  2017 bin -> ./packages/local/bin
    lrwxrwxrwx. 1 root root   18 Mar 30  2017 ade -> /usr/local/nde/ade
    

    After removing offending paths from PATH, make test is running successfully

    [user@hostname perl-5.28.3]$  export PATH=/bin:/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin
    
    [user@hostname perl-5.28.3]$  make test
    
    All tests successful.
    Elapsed: 1611 sec
    u=14.47  s=44.63  cu=731.82  cs=575.84  scripts=2474  tests=1209537