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

Inconsistent exit code between architectures?

Thread Next
From:
Jose Luis Martinez
Date:
May 29, 2010 08:03
Subject:
Inconsistent exit code between architectures?
Message ID:
20100528183833.29131.qmail@lists-nntp.develooper.com
Hello,

    I'm writing because I seem to be detecting some inconsistencies 
between platforms in perls' exit code when die is called. Hope it's the 
right list!

    I'm getting FAIL on some perls because one of my tests don't pass, 
as you can see in:
http://www.cpantesters.org/distro/N/Nagios-Plugin-DieNicely.html

    The test that fails is:
#   Failed test 'Exit code 9 for ./t/bin/notok_using_die_in_begin.t'
#   at t/002_test_outputs.t line 87.
#          got: 255
#     expected: 9
# Looks like you failed 1 test of 108.

    It basically executes a script that uses a module that only has
BEGIN { die 'DIED!!!' }
    in it's body. I found the exit code to be 9 (I was really expecting 
a 255).

    The thing is that on some platforms I get exit code 9 (tests pass) 
and on some exit code 255 (tests fail).

    I really don't know what the exit code 9 from perl stands for... But 
ultimately, it's not behaving in the same manner under different platforms.

    Some notes on the test suite: I see that I've declared "use 
DieModule;" in the script, but t/lib/DieModule.pm contains the wrong 
package name (dumb of me...):
package EvalModule;

BEGIN {
    die "DIED!!!";
}

1;

If I alter the package name to DieModule and do

$ perl -MDieModule ; echo 'EXIT' $?
DIED!!! at DieModule.pm line 4.
BEGIN failed--compilation aborted at DieModule.pm line 5.
Compilation failed in require.
BEGIN failed--compilation aborted.
EXIT 9

    This last example, if executed on other platforms returns 255

    Am I on to something? Or just plain wrong?

Jose Luis Martinez
jlmartinez@capside.com


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About