# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #42254]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42254 >


This showed up on Cygwin, but is most likely a problem on other 
platforms too.  Test t/src/io.t#4 (read) goes into an infinite loop if 
F<temp.file> is missing.

     io = PIO_open(interp, NULL, "temp.file", "<");
     /* this is for testing buffers, not for performance */
     PIO_setbuf(interp, io, 4);

     do {
         len = PIO_read(interp, io, buf, 3);
         buf[len] = '\0';
         /* dont write trailing spaces */
         PIO_printf(interp, "%d: %s\n", len, len ? buf : "EOF");
     } while (len > 0);

On Cygwin F<temp.file> is missing because the write test uses a not 
exported function and therefore doesn't even compile.

Now, the problem is that the returned C<len> is 16777215 (0x00FFFFFF), 
which is larger than zero and keeps the loop going until the "16777215:" 
output consumes enough memory (most of the time for quite large values 
of "enough").

This can easily be tested by unlink-ing F<temp.file> just before the 
read test, and running C<prove -v t/src/io.t>.

I think this bug affects the GCC toolchain, because I see it on Cygwin, 
MinGW and Linux (Ubuntu).

Now here's the funny part: All t/src/io.t tests are skipped on Win32 
(Visual C++) because they are broken.  But if I manually compile the 
read test and run it I get:

     C:\tmp>io_4.exe
     Hello, World!
     3: Hel
     3: lo,
     3:  Wo
     3: rld
     2: !

     0: EOF

     C:\tmp>del temp.file

     C:\tmp>io_4.exe
     -1:

Things I guess should be done:
     * Add test for missing file
     * limit number of iterations in above loop
     * S&D bug

Reply via email to