[PATCH] Port functions/shell to Solaris 10

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Port functions/shell to Solaris 10

Paul Eggert
* tests/scripts/functions/shell: Port exit-status calculation
to Solaris 10 with Perl 5.8.4.
---
 tests/scripts/functions/shell | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell
index 54514e8..93ff7cb 100644
--- a/tests/scripts/functions/shell
+++ b/tests/scripts/functions/shell
@@ -69,7 +69,13 @@ all: ; @echo $(.SHELLSTATUS)
     }
     waitpid($pid, 0);
     # .SHELLSTATUS for a signal gives 128 + the signal number
-    my $ret = $? + 128;
+    # my $ret = $? + 128;
+    my $ret = $?;
+    if (256 <= $ret) {
+       # Solaris 10 perl 5.8.4 puts signal number + 128 into the high 8 bits.
+       $ret >>= 8;
+    }
+    $ret |= 128;
 
     run_make_test('.PHONY: all
 $(shell kill -2 $$$$)
--
2.21.0


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Port functions/shell to Solaris 10

Paul Smith-20
On Tue, 2019-10-08 at 15:28 -0700, Paul Eggert wrote:
> * tests/scripts/functions/shell: Port exit-status calculation
> to Solaris 10 with Perl 5.8.4.

Thanks Paul.  I had hoped that my attempts to get Perl to tell me what
the expected return codes are on the local system would have been
sufficient but apparently not.  Perhaps Perl on Solaris does some magic
to convert this non-standard behavior into standard behavior.


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Port functions/shell to Solaris 10

Paul Eggert
On 10/10/19 3:28 PM, Paul Smith wrote:
> Perhaps Perl on Solaris does some magic
> to convert this non-standard behavior into standard behavior.

Yes, I think it's something along those lines. POSIX doesn't specify how
signal numbers and exit statuses are shoehorned into the 'int' status
updated by waitpid; apps are supposed to use WEXITSTATUS etc. to
retrieve the info from that 'int'. I think that Perl tries to
standardize this so that Perl apps just one way to shoehorn. One
possibility is that the version of Perl shipped with Solaris is so old
that it predates this Perl standardization. It is a bit of a mess.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Port functions/shell to Solaris 10

Gnu - Make - Bugs mailing list
On Fri, Oct 11, 2019 at 4:25 PM Paul Eggert <[hidden email]> wrote:
> One possibility is that the version of Perl shipped with Solaris is so old
> that it predates this Perl standardization. It is a bit of a mess.

Actually this patch fixes the same issue on aix with perl-5.10.1

regards, Dmitry

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Port functions/shell to Solaris 10

Andreas Schwab
In reply to this post by Paul Eggert
On Okt 11 2019, Paul Eggert <[hidden email]> wrote:

> On 10/10/19 3:28 PM, Paul Smith wrote:
>> Perhaps Perl on Solaris does some magic
>> to convert this non-standard behavior into standard behavior.
>
> Yes, I think it's something along those lines. POSIX doesn't specify how
> signal numbers and exit statuses are shoehorned into the 'int' status
> updated by waitpid; apps are supposed to use WEXITSTATUS etc. to retrieve
> the info from that 'int'. I think that Perl tries to standardize this so
> that Perl apps just one way to shoehorn.

The format is documented in perlvar(1).

Andreas.

--
Andreas Schwab, SUSE Labs, [hidden email]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make