Michael G Schwern via RT wrote:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=42148 >
>
> wb8tyw@gmail.com via RT wrote:
>>> Well, I've figured it out. For some reason loading Test::Builder changes the
>>> behavior of the exit code handling. I've been testing it with exit 5. Under
>>> Test::Builder that becomes 4. Without it's 0.
>>>
>>> perl -wle 'use Test::Builder; exit 5'
>> >
>>> works different from
>>>
>>> perl -wle 'exit 5'
>> This the results in the new POSIX mode of 5.11:
>
> Does the new t/exit.t work?
As I posted earlier, it worked in the new POSIX mode, not the VMS mode.
Show quoted text>
>> EAGLE> perl -wle "END { $? = 5; }"
>> EAGLE> show sym $status
>> $STATUS == "%X0035A029"
>>
>> Which as above preserves the code of 5 for Unix programs.
>>
>>> Because that causes a "%SYSTEM-F-ABORT" I wouldn't be surprised if something
>>> in vmsperl is actually freaking out. Anyhow, it has the desired effect.
>> The traditional code in perl on VMS converts any error code to
>> %SYSTEM-F-ABORT when Perl exits. It is the expected behavior.
>
> For the rest of this discussion, let's leave the new POSIX stuff out of it.
> I'm just trying to get exit.t working under normal conditions right now.
>
> If it's the expected behavior, why are they different on 5.10?
>
> $ perl -wle "exit 5"
> $ show sym $status
> $STATUS == "%X00000005"
Expected behavior, exit code is passed through to DCL.
Also an incorrect behavior if the exit code is a UNIX status, as does
not map to a valid VMS status code.
Show quoted text> $ perl -wle "END { $? = 5 }"
> %SYSTEM-F-ABORT, abort
> $ show sym $status
> $STATUS == "%X0000002C"
An error status was set. Traditionally these were translated to 0x2C on
exit. Again expected behavior.
Show quoted text> $ perl -wle "exit 6"
> %NONAME-?-NOMSG, Message number 00000006
> $ show sym $status
> $STATUS == "%X00000006"
Again expected behavior, exit code is passed through to DCL.
Show quoted text> $ perl -wle "END { $? = 6}"
> %SYSTEM-F-ABORT, abort
> $ show sym $status
> $STATUS == "%X0000002C"
And again, expected behavior, setting the error status caused the exit
status of 0x2c to be set.
Show quoted text> They're obviously not equivalent.
No. And when passed UNIX style values, they were not compliant with the
VMS conventions for the status codes.
The algorithm for encoding UNIX status values into VMS status codes
showed up in the VMS 7.x timeframe. Perl on VMS is much older than
that. Unfortunately it also was not documented. I have a bug filed to
get that documented in the VMS C runtime library manual, but am no
longer in a position to track the status of that bug.
Show quoted text> If the exit status is being preserved on the command line, it's not being
> preserved through a system() call like so:
>
> $ cat exit_test
> exit shift;
>
> $ perl -wle "system $^X, exit_test, 5; print $?"
> 0
Traditional behavior, VMS exit codes that are odd are considered
success. The VMS success status is 1, which when passed back to perl is
translated to 0.
Show quoted text> $ perl -wle "system $^X, exit_test, 4; print $?"
> %NONAME-F-NOMSG, Message number 00000004
> %NONAME-F-NOMSG, Message number 00000004
> 1024
Exit code 4 is a failure status of Fatal severity. It is also an
undefined code for the system facilty. This is passed through as an
error status.
When I tried that, I am not getting the duplicate error mesages, only one.
Show quoted text> $ perl -wle "system $^X, exit_test, 3; print $?"
> 0
You will see this for all odd values.
Show quoted text> $ perl -wle "system $^X, exit_test, 2; print $?"
> %NONAME-E-NOMSG, Message number 00000002
> %NONAME-E-NOMSG, Message number 00000002
> 512
Even statuses are failures. Status 2 is of Error severity, not as bad
as a Fatal.
Show quoted text> $ perl -wle "system $^X, exit_test, 1; print $?"
> %SYSTEM-F-ABORT, abort
> %SYSTEM-F-ABORT, abort
> 1024
And because traditionally VMS considers a UNIX exit status of 1 to be an
error, it gets mapped to 0x2c externally and 4 internally.
Show quoted text> It feels like system() is undoing the Unix exit() emulation.
It never was exactly correct on Perl on VMS in traditional mode, just a
compromise to signal success or error. But again, a correct but
undocumented convention did not show up until many years after the
behavior of Perl became expected on VMS.
We now have a more correct emulation, but backwards compatibility needs
to be maintained. I think it is SIGTERM that Perl is not trapping and
mapping back to the correct encoded Unix status.
Show quoted text>>> Unfortunately, now I get a string of "%SYSTEM-F-ABORT, abort" messages from
>>> the test which I'm having difficulty suppressing. But at least it works.
>> The existing Test/Simple.t in blead-perl emits 12 %SYSTEM-F-ABORT
>> messages. The TEST.COM code on VMS appears to deal with them.
>
> Test::Harness sure doesn't, the user gets a faceful of them. And there's
> going to be over 500 of them from exit.t. This is unacceptable.
I am not sure how to suppress them. VMS emits the error message when
given the one liner used in the test with an even status. Turning off
requires sending multiple commands, each on their own line before the
Perl command is executed, or capturing the stderr stream, and I have not
been able to get that to work on the system() call.
Craig or some one on the vmsperl list may have a better answer.
Also:
Encompasserve.org volunteers are investigating why scp is broken. I do
not have an eta on a fix.
Regards,
-John
wb8tyw@gmail.com
Personal Opinion Only