Skip Menu |
Report information
Id: 1117
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: vallon [at] bear.com
Cc:
AdminCc:

Operating System: HPUX
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.005_03
Fixed In: (no value)



Date: Fri, 30 Jul 1999 10:12:28 -0400 (EDT)
From: Justin Vallon <vallon [...] bear.com>
To: perlbug [...] perl.com
Subject: Open input pipe FileHandle interferes with die+exit
Cc: rodolphe [...] pearl.bear.com
Download (untitled) / with headers
text/plain 3.8k
----------------------------------------------------------------- [Please enter your report here] #!/usr/local/bin/perl5.005 -w use FileHandle; my $fh = new FileHandle; $fh->open('/bin/true |') || die 'die open'; # close($fh) fixes it # $fh = undef fixes it exit(1); Exits with zero return code. Tested on perl5.00[245]. It appears that the implicit close of $fh is changing the exit code. * If 'find / -print', then exit code is 13 (SIGPIPE) * If '/bin/false |' is used, the return code is zero. * If 'kill $$ |' is used, the return code is 15 (SIGTERM). My guess would be that $? from the close($fh) is being used as Perl's return code. It's probably doing exit($?). Then, only the low-order byte is passed back to the shell: * find : SIGPIPE => $? == 13 => exit(13) => exit code 13. * false : exit(1) => $? == 256 => exit(256) == exit(0) => exit code 0. * kill : SIGTERM => $? == 15 => exit(15) => exit code 15. -Justin vallon@bear.com [Please do not change anything below this line] ----------------------------------------------------------------- --- Site configuration information for perl 5.00503: Configured by software at Tue Apr 13 09:51:18 EDT 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=hpux, osvers=10.20, archname=PA-RISC1.1 uname='hp-ux swr1t4 b.10.20 a 9000735 2006572932 two-user license ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O', gccversion= cppflags='-DEMBED -DMULTIPLICITY -D_HPUX_SOURCE -Aa -I/usr/local/include' ccflags ='-DEMBED -DMULTIPLICITY -D_HPUX_SOURCE -Aa -I/usr/local/include' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib libs=-lnsl_s -lndbm -lgdbm -ldld -lm -lc -lndir -lcrypt libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred ' cccdlflags='+z', lddlflags='-b -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.00503: /a/vallon/lib/perl /usr/local/public/perl5.005_03/lib/5.00503/PA-RISC1.1 /usr/local/public/perl5.005_03/lib/5.00503 /usr/local/public/perl5.005_03/lib/site_perl/5.005/PA-RISC1.1 /usr/local/public/perl5.005_03/lib/site_perl/5.005 . --- Environment for perl 5.00503: HOME=/a/vallon LANG=C LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/licensed/ilog/views302.ACC/studio/hp_10_1.0:/a/vallon/bin/pearl:/a/vallon/bin/HPPA1_V10:/a/vallon/bin:/a/vallon/public/bin:/usr/local/bin:/usr/dt/bin:/usr/bin/X11:/usr/local/bin/X11:/usr/ucb:/bin:/usr/bin:/usr/bin/X11:/usr/bin:/usr/ccs/bin:/opt/Migration/bin:/usr/vue/bin:/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/pd/bin:/opt/perf/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/upgrade/bin:/opt/hparray/bin:/opt/aCC/bin:/opt/CC/bin:/opt/langtools/bin:/opt/imake/bin:/opt/ignite/bin:/usr/local/X11R5/bin:/usr/atria/bin:/usr/derivs/prod/bin:/usr/local/sybase-11.1.1/bin:/a/derivs/bin:/usr/derivs/bdprod/apps/bin:/usr/derivs/bdprod/bin:/usr/local/licensed/oi/scripts PERL5LIB=/a/vallon/lib/perl PERL_BADLANG (unset) SHELL=/usr/local/bin/bash ******************************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. ********************************************************************************
To: Justin Vallon <vallon [...] bear.com>
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19990730.001] Open input pipe FileHandle interferes with die+exit
Date: Fri, 30 Jul 1999 08:06:19 -0700
From: Gurusamy Sarathy <gsar [...] activestate.com>
Download (untitled) / with headers
text/plain 378b
On Fri, 30 Jul 1999 10:12:28 EDT, Justin Vallon wrote: Show quoted text
>#!/usr/local/bin/perl5.005 -w > >use FileHandle; > >my $fh = new FileHandle; >$fh->open('/bin/true |') || die 'die open'; > ># close($fh) fixes it ># $fh = undef fixes it >exit(1); > >Exits with zero return code. > >Tested on perl5.00[245].
Please try 5.005_58. I put in a fix for this. Sarathy gsar@activestate.com


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org