Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E5D179E.B9A19256@phekda.freeserve.co.uk> Date: Wed, 26 Feb 2003 19:38:06 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: Laszlo Molnar , DJGPP workers Subject: DJGPP port of Perl 5.6.1 & POSIX::WEXITSTATUS Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. When I was testing out the DJGPP port of autoconf 2.57 with Perl 5.6.1, I noticed that POSIX::WEXITSTATUS was broken. I think I've just discovered the problem. DJGPP's W* macros in expect the program return code to be returned in the lower 8 bits of the status variable from wait*. This is different to, say, Linux, where the return code is expected to be in bits 8-15 (from on my RedHat Linux 6.2 box). Perl's "system" call returns the exit status in bits 8-15 of the return value. It is described on "man perlfunc" as the return value of the wait system call. Since DJGPP doesn't have a working wait call, the DJGPP port of Perl has a load of code that uses system() and converts the return code of system() from the DJGPP format to the Perl format. $? is the "status returned by the last pipe close" (see "man perlvar"), which can be the status of the last call to Perl's "system" call. POSIX::WEXITSTATUS($foo) returns the result of the C macro WEXITSTATUS on the variable $foo. The problem is that the Perl format is not the same as the format used by the WEXITSTATUS, etc. macros from DJGPP's . So when you do POSIX::WEXITSTATUS($?), to get the return code of the last program, there's a mismatch. There seem to be two solutions: 1. Make POSIX::WEXITSTATUS (and the other POSIX:W*) do something special for DJGPP, to cope with the inconsistency between the return code of Perl's "system" call and POSIX::W*. 2. DJGPP doesn't have working wait*. So we can make W* from compatible with Linux (and other Unices, I'm guessing) without breaking anything. I.e.: follow the Unix Way. Solution 1 will fix the build with DJGPP 2.03. I think we should adopt solution 2 for DJGPP 2.04. Does this make sense? Does anyone agree/disagree with the solutions? Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]