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

I'm executing a certain program from a perl wrapper, this usually works fine but sometimes gives me a core-dump with the return value 139 from the system call. I'm running OS red hat. What does this 139 mean. Stefán Þór Pálsson

Replies are listed 'Best First'.
Re (tilly) 1: return code 139
by tilly (Archbishop) on Mar 04, 2002 at 12:28 UTC
    The meaning of return values varies from operating system to operating system. You can find out what it is for your system using the magical one-liner:
    perl -e '$! = 139; print $!'
    If your return value was over 256, then divide by 256 to get the return value from within the program. What that means is up to the program.
Re: return code 139
by MZSanford (Curate) on Mar 04, 2002 at 12:25 UTC
    139 is the system return code to indicate a segmentation violation. I found a few references here and here
    from the frivolous to the serious
      If the error returned is >128, subtract 128 to get the signal number. 139-128=11, SIGSEGV, segmentation violation.

      The following is from perldoc -f system:

      You can check all the failure possibilities by inspecting `$?' like this:

      $exit_value = $? >> 8; $signal_num = $? & 127; $dumped_core = $? & 128;

      -rr

Re: return code 139
by steves (Curate) on Mar 04, 2002 at 14:23 UTC

    On UNIX systems, exit values can be interpreted using a set of macros found in the C header file sys/wait.h. The Perl POSIX module makes these available to Perl.