
slaven.rezic at berlin
Oct 1, 2002, 2:40 PM
Post #2 of 4
(65 views)
Permalink
|
|
Re: [perl #17711] perl's fork resets open filehandles in parent process
[In reply to]
|
|
"SEAN CUSACK, BLOOMBERG/ 499 PARK" (via RT) <perlbug [at] perl> writes: > # New Ticket Created by "SEAN CUSACK, BLOOMBERG/ 499 PARK" > # Please include the string: [perl #17711] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17711 > > > > Cc: ascotti [at] bloomberg > > This is a bug report for perl from scusack [at] bloomberg, > generated with the help of perlbug 1.26 running under perl 5.00503. > > ----------------------------------------------------------------- > [Please enter your report here] > > err.in: > > 1234567890 > 1234567890 1234567890 > 1234567890 1234567890 1234567890 > 1234567890 1234567890 > > err.pl: > > #!/usr/local/bin/perl > > print "without fork, this works:\n"; > open( ERR, "err.in" ); > while( <ERR> ) > { > print $_; > } > close(ERR); > > print "with fork, even though the child does nothing, this loops forever, ". > "because the fork somehow resets the parent's filehandle:\n"; > open( ERR, "err.in" ); > while( <ERR> ) > { > print $_; > if( !fork() ) { exit(0); } > wait(); > } > close(ERR); > > [Please do not change anything below this line] > ----------------------------------------------------------------- > Maybe this is Solaris specific. I can't reproduce the problem on FreeBSD with perl 5.00503, 5.6.1, and 5.8.0. Regards, Slaven > --- > Site configuration information for perl 5.00503: > > Configured by ascotti at Wed Apr 21 08:16:55 EDT 1999. > > Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: > Platform: > osname=solaris, osvers=2.6, archname=sun4-solaris > uname='sunos tkr27 5.6 generic_105181-13 sun4u sparc sunw,ultra-enterprise ' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef useperlio=undef d_sfio=undef > Compiler: > cc='cc', optimize='-O', gccversion= > cppflags='-I/usr/local/include' > ccflags ='-I/usr/local/include' > stdchar='unsigned char', d_stdstdio=define, usevfork=false > intsize=4, longsize=4, ptrsize=4, doublesize=8 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 > alignbytes=8, usemymalloc=y, prototype=define > Linker and Libraries: > ld='cc', ldflags =' -L/usr/local/lib' > libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib > libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt > libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' > cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib' > > Locally applied patches: > > > --- > @INC for perl 5.00503: > /usr/local/lib/perl5/5.00503/sun4-solaris > /usr/local/lib/perl5/5.00503 > /usr/local/lib/perl5/site_perl/5.005/sun4-solaris > /usr/local/lib/perl5/site_perl/5.005 > . > > --- > Environment for perl 5.00503: > HOME=/home/scusack > LANG (unset) > LANGUAGE (unset) > > LD_LIBRARY_PATH=/bb/bin/informix/ifmx7.3/lib:/bb/bin/informix/ifmx7.3/lib/esql: > LOGDIR (unset) > > PATH=/bbsrc/tools/bbcm:/usr/atria/bin:/bin:/usr/bin:/usr/sbin::/usr/bin/X11:/usr > /local/bin:/bb/bin:/home/scusack/scripts:/home/scusack/bin:/opt/SUNWspro/bin > PERL_BADLANG (unset) > SHELL=/usr/bin/ksh > > > > -- Slaven Rezic - slaven.rezic [at] berlin tktimex - project time manager http://sourceforge.net/projects/ptktools/
|