perl 5.8.7-4: pipe from cmd.exe hangs

Gerrit P. Haase gerrit@familiehaase.de
Mon Sep 19 18:02:00 GMT 2005


ohsie_david@emc.com wrote:

> Dear All,
> 
> The following perl program calls out to the Windows command shell to "type"
> the contents of a file and then prints the contents of the file.
> 
> The program hangs at the "open" statement whenever the input file is larger
> than 12328 bytes on my Win2K installation.  It will work for smaller files.
> 
>   ($#ARGV == 0) || die "Usage type.pl <filename>";
>   open (FILEIN, "cmd /c type $ARGV[0] |") || die "open failed";
>   print "Open succeeded";
>   while (<FILEIN>)
>   {
>     print $_;
>   }
> 
> I tried this program on Windows XP and it was able to handle a file up to
> 16384 bytes in size.   If "cmd /c type" is replace with "cat", then the
> program works fine.  I also tried this with an older cygwin perl version
> 5.8.2-1 and it works fine. 
> 
> The problem was discovered when running a "makedepend" program implemented
> in perl that invokes the Microsoft C++ compiler to do the C preprocessing.
> When I upgraded from a ~2 year old cygwin distribution to the current one,
> this problem cropped up.
> 
> Cygcheck output is embedded below.
> 
> I appreciate any light that people on the list can shed on this problem.

I can confirm that it works with perl 5.8.6-4 and cygwin 1.5.17 and it
doesn't work with perl 5.8.7-4 on cygwin 1.5.18.

Please tried a recent snapshot -> http://cygwin.com/snapshots/, i.e. it
should work with todays snapshot (2005-09-19).


Works ok:

$ uname -a
CYGWIN_NT-5.0 ismene 1.5.17(0.129/4/2) 2005-05-25 19:38 i586 unknown 
unknown Cygwin

$ cygcheck -c perl
Cygwin Package Information
Package              Version        Status
perl                 5.8.6-4        OK

$ cat open.pl
#!/usr/bin/perl
($#ARGV == 0) || die "Usage type.pl <filename>";
print "File to open: $ARGV[0]\n";
open (FILEIN, "/c/WINNT/system32/CMD.EXE /c type $ARGV[0] |") || die 
"open failed";
print "Open succeeded\n";
while (<FILEIN>)
{
   print $_;
}

$ perl -e 'open (FILE,">open.txt"); for ($i=0;$i<112329;$i++) { print 
FILE "a" }; close FILE'

$ ls -l open.txt
-rw-rw-rw-  1 gerrit Domänen-Admins 112329 Sep 19 18:46 open.txt

$ ./open.pl open.txt
File to open: open.txt
Open succeeded
aaaaaaaaaaaaaa.....


Works nok:

$ uname -a
CYGWIN_NT-5.1 INSPIRON 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown 
unknown Cygwin

$ cygcheck -c perl
Cygwin Package Information
Package              Version        Status
perl                 5.8.7-4        OK


Thanks for the report,
Gerrit
-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list