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

forking open breaks in 5.005_63 #1094

Closed
p5pRT opened this issue Jan 26, 2000 · 3 comments
Closed

forking open breaks in 5.005_63 #1094

p5pRT opened this issue Jan 26, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 26, 2000

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

Searchable as RT2048$

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2000

From dcd@tc.fluke.com

The following contrived code works in 5.005_57 but blocks (on a 'STDIN' read)
in the open/fork in the second call to sub cpp.

It is interesting to note that
if the code in the subroutine is expanded inline
then it works. (my guess is there may be some 'state' associated
with the open itself.

$|=1;

sub cpp
{
  my $file = shift;
print "cpp $file\n";
  if (open(FROM_CPP, "-|") == 0) {
  print STDERR " child $file\n";
  print "$file\n";
  exit;
  }
  print STDERR " parent\n";
  while (<FROM_CPP>) {
  print "FROM_CPP​:$_";
  }
  close(FROM_CPP);
}

cpp 'segment.h';
cpp 'foo';

I expected

cpp segment.h
parent
child segment.h
FROM_CPP​:segment.h
cpp foo
parent
child foo
FROM_CPP​:foo

but all I get with 5.005_63 is

cpp segment.h
parent
child segment.h
FROM_CPP​:segment.h
cpp foo
parent

Perl Info


Site configuration information for perl 5.00563:

Configured by dcd at Tue Dec 14 16:21:58 PST 1999.

Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration:
  Platform:
    osname=linux, osvers=2.3.33, archname=i686-linux
    uname='linux dd 2.3.33 #1 tue dec 14 15:38:25 pst 1999 i686 '
    config_args='-Doptimize=-g -de -Dcf_email=dcd@tc.fluke.com'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    use64bits=undef usemultiplicity=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=2.7.2.3
    cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /shlib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    libc=/lib/libc.so.5.4.44, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl 5.00563:
    /usr/local/lib/perl5/5.00563/i686-linux
    /usr/local/lib/perl5/5.00563
    /usr/local/lib/site_perl/5.00563/i686-linux
    /usr/local/lib/site_perl
    .


Environment for perl 5.00563:
    HOME=/home/dcd
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/dcd/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/usr/local/samba:/home/hobbes/tools/scripts:/home/hobbes/tools/linux:/usr0/hobbes/tools/scripts:/usr0/dcd/bin:/apps/general/bin:/usr/public
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2000

From @gsar

On Wed, 26 Jan 2000 18​:40​:47 PST, David Dyck wrote​:

The following contrived code works in 5.005_57 but blocks (on a 'STDIN' read)
in the open/fork in the second call to sub cpp.

You want change#4757 posted here, also available at​:

  ftp​://ftp.linux.activestate.com/pub/staff/gsar/APC/diffs/4757.gz

It may or may not apply cleanly to _63, I haven't checked.

Sarathy
gsar@​ActiveState.com

@p5pRT
Copy link
Author

p5pRT commented Jan 26, 2000

From [Unknown Contact. See original ticket]

On Wed, 26 Jan 2000, Gurusamy Sarathy wrote​:

On Wed, 26 Jan 2000 18​:40​:47 PST, David Dyck wrote​:

The following contrived code works in 5.005_57 but blocks (on a 'STDIN' read)
in the open/fork in the second call to sub cpp.

You want change#4757 posted here, also available at​:

ftp&#8203;://ftp\.linux\.activestate\.com/pub/staff/gsar/APC/diffs/4757\.gz

It may or may not apply cleanly to _63, I haven't checked.

Sarathy
gsar@​ActiveState.com

Thanks,
  The patch applied with a small fuzz, and fixed the problem!
  David

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

No branches or pull requests

1 participant