delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/18/08:43:36

From: Martin Stromberg <Martin DOT Stromberg AT lu DOT erisoft DOT se>
Message-Id: <199908181226.OAA24678@spica.lu.erisoft.se>
Subject: Re: Make 3.78 is in pretest
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Wed, 18 Aug 1999 14:26:00 +0200 (MET DST)
Cc: peuha AT cc DOT helsinki DOT fi, pausmith AT nortelnetworks DOT com
X-Mailer: ELM [version 2.4 PL24]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

Eli said:

> Also, tests where Make exits with a non-zero status print something
> like "Error running make (512): ...".  512 comes from this line:
> 
>    $code = &run_command_with_output($logname,$command);
> 
> I don't understand how does Perl get this weird exit status; I'm
> guessing that the real exit status is 2, and Perl is somehow shifting
> it left by 8 bits, but I don't understand why does it do that.  See
> also the discussion of features/errors below, which indicates that at
> least in that case, the exit code is NOT shifted left.

...

>  $delete_error_code = $? >> 8;
> 
> This line assumes that the exit code is in the upper 8 bits of the
> status returned by the subsidiary program.  This is non-portable;
> in particular, DJGPP returns the exit code in the lower 8 bits (so
> the shift shouldn't be done).  Does Perl have a way for extracting
> the exit code in a portable way, using the WEXITSTATUS macro?  If
>  so, the script should use that.

Perl's perlvar page says:
     $?      The status returned by the last pipe close, backtick
             (``) command, or system() operator.  Note that this
             is the status word returned by the wait() system
             call (or else is made up to look like it).  Thus,
             the exit value of the subprocess is actually ($? >>
             8), and $? & 255 gives which signal, if any, the
             process died from, and whether there was a core
             dump.  (Mnemonic: similar to sh and ksh.)
 
             Note that if you have installed a signal handler for
             SIGCHLD, the value of $? will usually be wrong
             outside that handler.
 
             Inside an END subroutine $? contains the value that
             is going to be given to exit().  You can modify $?
             in an END subroutine to change the exit status of
             the script.
 
             Under VMS, the pragma use vmsish 'status' makes $?
             reflect the actual VMS exit status, instead of the
             default emulation of POSIX status.

This gives some clues on what Eli said. The exit code is _supposed_ to be 
in the upper eigth bits in perl.

...

> ! &touch("four.example");

...

> ! &touch("example.for");

Shouldn't this be "example.four"? Or mustn't the filename exceed 8.3 
limitations?


About "...":
I can't see any differences in the patches. (I must be blind, or my brain 
isn't parsing right right now.)



Right,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019