Rafael Garcia-Suarez wrote:
"John E. Malmberg" <[EMAIL PROTECTED]> wrote:
This change seems to have forced the several routines that were
translating the status correctly on VMS to use STATUS_EXIT which is
basically resulting a number of success status values being translated
to a fatal error condition instead of being passed through.
I am not sure that I can untangle this so that the old somewhat broken
VMS exit behavior is completely preserved.
I am not sure we want to preserve the old behaviour in 5.10. More
consistency would be appreciable, esp. now that we have more variables
to look at with the new ${^CHILD_ERROR_NATIVE}.
The problem is the use of the STATUS_UNIX_SET macro.
In Perl.c/Perl_my_exit, STATUS_UNIX_SET needs to set the VMS exit status
based on what ever UNIX exit code has been handed to it and the former
default was to assume that it was a native status code if the UNIX code
was greater than 1.
In mg.c and pp_sys.c, STATUS_UNIX_SET needs to synchronize the NATIVE
error status with the UNIX status. In the case of VMS, the NATIVE error
status is undefined unless the UNIX status == EVMSERR. A lookup table
is needed on VMS to translate the UNIX status codes back to VMS, it is
too complex for a macro.
For VMS, these are two distinct algorithms with only a little in common.
I suspect that is the case for other platforms also. The same macro
can not be used for both.
I Think part of the confusion is that other then the name of the macros,
there is not any documentation as to what they are expected to do.
This is what they appear to do based on what I am seeing them used for.
STATUS_EXIT - validates and returns a NATIVE exit status code for the
platform from the existing UNIX or Native status values.
STATUS_NATIVE_SET - takes a NATIVE status code and converts it to a
UNIX/POSIX status value and updates both the native and PL_statusvalue
as needed. This seems only exist for VMS and is used in the exit
handling where it is needed the least.
STATUS_NATIVE_CHILD_SET - same as STATUS_NATIVE_SET, but shifts the UNIX
value over the correct number of bits to be a child status. Usually
the number of bits is 8, but that could be platform dependent. The
NATIVE status code is presumed to have either from a child process.
STATUS_UNIX_SET - takes a UNIX/POSIX errno value and attempts to update
the NATIVE status to an equivalent value. Can not be used to translate
exit code values as exit code values are not guaranteed to have any
relationship at all to errno values. This is a bit broken on VMS.
A new macro is needed for use with Perl_my_exit to replace it calling
STATUS_UNIX_SET:
STATUS_UNIX_EXIT_SET - Takes a UNIX/POSIX exit code and sets the NATIVE
error status based on it. It does not assume that the UNIX/POSIX exit
codes have any relationship to errno values and are only being encoded
into the NATIVE form so that they can be properly passed through to the
calling program or shell. It looks like this is what STATUS_NATIVE_SET
used to attempt to do. Only with VMS native codes, I can tell the
difference between an encoded child exit code that should be passed
through and an error condition that must be signaled.
-John
[EMAIL PROTECTED]
Personal Opinion Only