develooper Front page | perl.perl5.porters | Postings from October 2005

Re: $^CHILD_ERROR_NATIVE issues

Thread Previous
From:
Ken Hirsch
Date:
October 2, 2005 08:39
Subject:
Re: $^CHILD_ERROR_NATIVE issues
Message ID:
433FFF0D.2050000@ftml.net
Gisle Aas wrote:

>Ken Hirsch <kenhirsch@ftml.net> writes:
>...
>  
>
>>Or, to summarize,
>>
>>$? = 0 + $?
>>
>>shifts the whole thing left 8 bits.
>>    
>>
>
>The STATUS_UNIX_SET(n) macro needs to be overriden for this platform
>then.  The default one just make 'PL_statusvalue_posix = PL_statusvalue'.
>Unfortunately there are no POSIX macros that allow you to construct
>the native status value portably; what we want is the reverse of
>WEXITSTATUS() and friends.
>
>Regards,
>Gisle
>
>  
>
I think the problem is rather that the same macro STATUS_NATIVE_SET is 
used for setting $? on exit() and on setting $? after wait().

This is wrong since code in END blocks does not expect $? to be shifted 
left 8 bits.

I propose:
1. Changing STATUS_NATIVE_CHILD_SET to be directly defined as the code 
that fixes up $? instead of indirectly as STATUS_NATIVE_SET
2. Changing STATUS_NATIVE_SET to be the same as STATUS_UNIX_SET
3. Changing two places in the code where STATUS_NATIVE_SET is called to 
call STATUS_NATIVE_CHILD_SET instead.

Attached is a patch which does this.  I've tested it on MPE/iX 7.5 and 
HP-UX 11



Thread Previous


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