develooper Front page | perl.perl5.porters | Postings from January 2008

[perl #50374] unexpected exit in open3() on win32

From:
Davies, Alex
Date:
January 29, 2008 17:38
Subject:
[perl #50374] unexpected exit in open3() on win32
Message ID:
rt-3.6.HEAD-4355-1201619970-1937.50374-75-0@perl.org
# New Ticket Created by  "Davies, Alex" 
# Please include the string:  [perl #50374]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50374 >


This is a bug report for perl from adavies@ptc.com,
generated with the help of perlbug 1.35 running under perl v5.8.7.


-----------------------------------------------------------------
[Please enter your report here]

IPC::Open3::open3() appears to exit on Win32 when STDOUT is redirected
_and_ it is called via the associated perl. It works as expected
if only one of the above conditions is met.
Here's a walk thro':

  D:\>cat open3_testcase.pl
  require IPC::Open3;
  require IO::File;
  my $cmd = "find.exe ."; # a random command to run
  *CMD_ERR = IO::File->new_tmpfile;
  print "start $^X\n";
  my $pid = eval {
          IPC::Open3::open3(undef, \*CMD_OUT, ">&CMD_ERR", $cmd);
  };
  $@ and die "failed to run $cmd\n$@";
  print "end $pid\n";
  
  D:\>open3_testcase.pl
  start C:\perl3\bin\perl5.8.7.exe
  end 812
  
  D:\>C:\perl3\bin\perl5.8.7.exe open3_testcase.pl
  start C:\perl3\bin\perl5.8.7.exe
  end 2816
  
  D:\>C:\perl3\bin\perl5.8.7.exe open3_testcase.pl > output
  
  D:\>cat output
  start C:\perl3\bin\perl5.8.7.exe
  end 1880
  
  D:\>open3_testcase.pl > output
  
  D:\>cat output
  start C:\perl3\bin\perl5.8.7.exe
  
  D:\>


By placing print statements into IPC::Open3, it appears to be exiting
during the call to:

	# line 323 VERSION 1.0106
	$fd->{handle}->fdopen($saved{fileno $fd->{open_as}} ||
$fd->{open_as},
			      $fd->{mode});


Any idea what's happening here? Is it a bug?


Cheers, alex.



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
---
Site configuration information for perl v5.8.7:

Configured by adavies at Thu Aug 11 14:02:10 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='12.00.8804', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"c:\perl3\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"c:\perl3\lib\CORE"  -machine:x86'

Locally applied patches:
    

---
@INC for perl v5.8.7:
    C:/perl3/lib
    C:/perl3/site/lib
    .

---
Environment for perl v5.8.7:
    HOME=C:\alex
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program
Files\Tcl-8.4.8.0\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;
C:\perl3\bin;D:\alex\bin;C:\cygwin\bin;C:\Program
Files\Perforce;C:\Program Files\Microsoft Visual
Studio\VC98\Bin;C:\Program Files\Microsoft Visual
Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual
Studio\VC98\MFC\Lib;C:\Program
Files\Tcl-8.5.0.0_singlethreaded\bin;D:\data\ruby-1.85-21\bin;C:\Program
Files\Tcl-8.5.0.0b5\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program
Files\Microsoft SQL Server\90\Tools\binn\
    PERL_BADLANG (unset)
    SHELL (unset)




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About