Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open input pipe FileHandle interferes with die+exit #294

Closed
p5pRT opened this issue Jul 30, 1999 · 2 comments
Closed

Open input pipe FileHandle interferes with die+exit #294

p5pRT opened this issue Jul 30, 1999 · 2 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jul 30, 1999

Migrated from rt.perl.org#1117 (status was 'resolved')

Searchable as RT1117$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 30, 1999

From vallon@bear.com

#!/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

Perl Info


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.
********************************************************************************


@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 30, 1999

From @gsar

On Fri, 30 Jul 1999 10​:12​:28 EDT, Justin Vallon wrote​:

#!/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.