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 !!!
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 $