Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 44359 - perl-5.8.x signal handler doesn't work as expected
Summary: perl-5.8.x signal handler doesn't work as expected
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-11 07:06 UTC by François-Xavier LAMARE
Modified: 2004-03-14 04:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description François-Xavier LAMARE 2004-03-11 07:06:17 UTC
Hi!

This code sample is unable to work with perl 5.8.[2-3]. It works with 5.6.1...
Aim : report the return code of last command executed thanx to signal handlers.

Problem : instead of returning '0', it returns 16777215...

Don't know how to re-write the signal handler for it to work with 5.8.x (i'm not a developper :-(  

thanx for your support !
Tested on 2 different gentoo boxes :

Kernel 2.6.2 || 2.4.22-gentoo-r7
Glibc 2.3.2-r9 || 2.3.2-r1
gcc 3.3.220031218  || gcc 3.2.3 20040422

hope this is not too off-topic and/or 'gentoo-related' enough...

Anyway, I really thank you in advance !!


Reproducible: Always
Steps to Reproduce:
1.Create this perl script :
#/bin/perl -w

sub waitforit {
my ($wpid,$rc);
        $wpid=wait;
        $APPLICATION_RC=$?>>8;
        $SIG{CHLD}=\&waitforit;
}

$SIG{CHLD}=\&waitforit;


$r=`echo hello_gentoo_devs`;
printf($APPLICATION_RC);

2. run it :
perl -w test.pl
3.

Actual Results:  
Prints 16777215 

Expected Results:  
Should print 0 !!!
Comment 1 Michael Cummings (RETIRED) gentoo-dev 2004-03-14 04:04:15 UTC
This is hardly a "bug" of gentoo or perl. You're just not fast enough sometimes. Below is my running your code on my box as fast my fingers could do a !!. I got 0 a few times, 16777215 others. This all has to do with how long it takes your system to return the pid in your wait call (and wpid and $? should be the same value, btw, perldoc -f wait). No offense intended, but this kind of question is better suited for http://www.perlmonks.org than bugs.gentoo.

mcummings@enki tmp $ perl ug
0
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
16777215
mcummings@enki tmp $ perl ug
0
mcummings@enki tmp $