Re: [doughera@lafcol.lafayette.edu: Re: Perl 5.001/Linux ELF pipe.t error

Andreas Koppenhoefer (koppenas@koppenas.informatik.uni-stuttgart.de)
Tue, 18 Jul 1995 17:53:23 +0200 (MET DST)


A fix/workaround for this was sent to Larry Wall (12 Jun 95) and Andy
Doughera (10 Jun 95). I don't know whether my fixes are included in
the newest set of perl patches or not.

> Subject: [doughera@lafcol.lafayette.edu: Re: Perl 5.001/Linux ELF pipe.t error test 7]
>
> > The subject line says most of it. I hope this is not an
> > intrusion; I am a novice at C, and can't offer a solution to the
> > problem that I've come across.
> >
> > I've just compiled Perl 5.001 under Linux 1.3.8, using GCC 2.7.0
> > and version 5.0.9 of libc.
> >
> > The compilation went smoothly, but I get one failed test, the 7th
> > test in pipe.t. (It looks like maybe this tests whether Perl will
> > be able to provide error handling for a broken pipe condition
> > (?).)
>
> The problem is (apparently) that Linux uses more than one signal name for
> a specific signal number. I don't know if this is just for the 1.3.x
> series of kernels or not, but it appears to be a recent change. I'm also
> not sure if this will continue to be the case for new kernels or if it will
> go away, so I don't know if it's worth it to work hard in Configure &
> perl to compensate.
>
> For now, I'm not certain offhand if there's a graceful way to handle this
> in perl itself, though it seems there ought to be.
>
> Anyway, you can just change manually change the names in config.sh (e.g.
> change IOT to ABRT) and to compensate for whatever duplicates are in
> /usr/include/linux/signal.h.

The history: At April, 21st, I'd sent a patch to Larry which should
fix sigtrap package. That patch made its way to Andy's patch-5.001i or
earlier. Unfortunately my fix was wrong. The result was failing test
pipe.t on all linux systems. Therefore I sent a second workaround
patch.

I'll include last my mail to Larry and Andy.

- Andreas

PS: This mail is not pgp signed by exception, 'cause it would mangle
the patch included (lines starting with dashes).

-----------------------------------------------------------------------------
>From koppenas Mon Jul 10 20:07:24 1995
Subject: patch for perl5.001i/Configure - signal names - second try (fwd)
To: doughera@lafcol.lafayette.edu
Date: Mon, 10 Jul 1995 20:07:25 +0200 (MET DST)
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 4854
Status: RO

Hello Andy,

about a month ago I've sent a patch to Larry which fixes a little bug
in Config.sh. The bug causes t/io/pipe.t fail on Linux. Since it's not
yet included in your latest patches, I send it to you too.

Thank you very much for your work on perl.

Andreas

----- cut here ----- snip snap -------------------------------------
>From koppenas Mon Jun 12 17:49:33 1995
Subject: patch for perl5.001i/Configure - signal names - second try
To: lwall@netlabs.com
Date: Mon, 12 Jun 1995 17:49:33 +0200 (MET DST)
Reply-To: Andreas.Koppenhoefer@studbox.uni-stuttgart.de (Andreas Koppenhoefer)
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 4121

Hello Larry,

some time ago I'd you sent a simple patch for Configure. Unfortunately
my patch introduced another bug to perl. I'm sorry about that - mea
culpa. In the hope perl5.002 is not yet release, I send you a
correction!

I've found my own bug while compiling/testing perl5.001i:
perl5.001i/t/io/pipe.t fails because

$SIG{'PIPE'} = 'broken_pipe';

installs an interrupt handler for SIGALRM instead of SIGPIPE! Perl is
not able to handle more than one signal name for a given signal number
as I thought before.

Therefore it's necessary to patch Configure once more.
=============================================================================
--- perl5.001i/Configure.orig Wed Jun 7 09:09:12 1995
+++ perl5.001i/Configure Mon Jun 12 17:18:14 1995
@@ -7358,8 +7358,6 @@
$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
if (sig[$3] == "")
sig[$3] = substr($2,4,20)
- else
- sig[$3] = sig[$3] " " substr($2,4,20)

if (max < $3 && $3 < 60) {
max = $3
=============================================================================
This patch makes sure that
a) only one signal name gets defined for each signal number and
b) the first signal name for a given signal number is used.

Comparing to plain 5.001 or 5.000 the last signal name defined in
signal.h was used formerly.

Just for your information I'll include my first patch here again.
=============================================================================
Forwarded message:
> From koppenas Fri Apr 21 18:25:33 1995
> Subject: patch for perl5.001/Configure - signal names
> To: lwall@netlabs.com
> Date: Fri, 21 Apr 1995 18:25:33 +0200 (MET DST)
> Reply-To: Andreas.Koppenhoefer@studbox.uni-stuttgart.de (Andreas Koppenhoefer)
>
> Hello Larry,
>
> here is a simple improvement (patch) for your perl5.001 Configure
> script. Hope you like it.
>
> Linux and maybe other unix systems have more than one signal name for a
> specific signal number.
>
> Excerpt from /usr/include/linux/signal.h (Linux 1.2.5):
> - -----------------------------------------------------------------------------
> [...]
> #define SIGQUIT 3
> #define SIGILL 4
> #define SIGTRAP 5
> #define SIGABRT 6
> #define SIGIOT 6
> #define SIGBUS 7
> #define SIGFPE 8
> #define SIGKILL 9
> [...]
> - -----------------------------------------------------------------------------
> Take a close look at signal number 6...
>
> In the current version of Configure (perl5.001 with Andy Dougherty's
> patches a..e) only the last signal name listed in signal.h
> will make its way thru Configure. In the case of Linux SIGABRT is
> thrown away, because there is an alias SIGIOT.
>
> As a result, package sigtrap will mumble about unknown signal ABRT!
>
> A simple patch for Configure which avoids this...
> -----------------------------------------------------------------------------
> --- perl5.001e/Configure.orig Sun Mar 12 08:35:24 1995
> +++ perl5.001e/Configure Fri Apr 21 12:09:24 1995
> @@ -7016,7 +7063,11 @@
> xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`" "`./findhdr linux/signal.h`
> set X `cat $xxx 2>&1 | $awk '
> $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
> - sig[$3] = substr($2,4,20)
> + if (sig[$3] == "")
> + sig[$3] = substr($2,4,20)
> + else
> + sig[$3] = sig[$3] " " substr($2,4,20)
> +
> if (max < $3 && $3 < 60) {
> max = $3
> }
> -----------------------------------------------------------------------------
> As far as I can see, this patch doesn't hurd on other systems.
> [...]
=============================================================================
Hope I'm right this time.

- Andreas
--- cut here ----- snip snap -------------------------------------

-- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland 
prefered languages: German, English, C, perl ("Just another Perl hacker,")
SMTP:   koppenas@informatik.uni-stuttgart.de            (university address)
        Andreas.Koppenhoefer@studbox.uni-stuttgart.de   (my home address)
privat: Belaustr. 5/3, D-70195 Stuttgart, Germany,
	Earth, Sector ZZ9 plural Z alpha
phone:  +49 711 694111 and +49 711 6999006 (19-22h MEZ=GMT+1)