#916 lines() returns 0 prematurely for pipes on unix

v4.1
closed
5
2012-08-14
2010-06-17
No

Using 4.0.1 on a Fedora 13 on a new build multicore AMD64, lines() for standard input returns 0 at startup when there is yet no data in the pipeline.

The command issued is:

./delcmt <fplspy.c |="" rexx="" redtab="" --="" fplspy="" home="" john="" src="" specs="" redtab:="" No="" tokentypes="" found="" in="" <stdin=""> read 0 lines.

delcmt does produce output when I type
./delcmt <fplspy.c | more

All of this worked fine on a uniprocessor Fedora6 which has now gone to the knackers' yard.

Calling linein() also returns no data, so at least it is consistent in failing. I tried adding sleep 1 to the rexx program before touching any files, but apparently the standard input stream is already open at that time, for that didn't fix it.

On unix, a read for pipes (and indeed all but regular files) may return less than the requested size even though more data are available. This used to be the original bug in OS/2, which taught me never to try to read more than 512 bytes from a stream.

A non-blocking read (which is what I think the chaps in Sindelfingen tried) won't cut it.

The bug is the atEof inline (common/platform/unix/SysFile), but I wasn't able to spot exactly why the buffer wasn't loaded.

I assume what happens now is that the pipeline and its invoking shell now run on three different cores; thus, timing is undoubtedly different. I think I've observed that the child runs before the parent on uniprocessor fork().

I've got a number of other REXX programs and they all work (but they use files rather than pipes).

j.

Discussion

  • John P. Hartmann

    A test case:

    echo howdy|rexx -e 'say lines()'

    I get the output 0. Running this test case on a two-core atom gets the same result, but still Fedora13.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-08-10

    John,

    Sorry you haven't got any response on this, we appreciate your opening bugs.

    I believe this is similar to: 2975571 Interpreter does not provide STDIN in pipeline.

    That bug was fixed by revision 5744.

    Your test case below:

    echo howdy|rexx -e 'say lines()'

    now produces 1 with an ooRexx built from trunk on my Fedora 13 64-bit system, which is also a multicore macine.

    I'm going to mark this as fixed. The fix should appear in the next release.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-09-08

    Putting this in group v4.0.2 which is the group I've been using to signal that the bug fix should go into the next bug release. It will actually be the 4.1.0 release.

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-10-09

    Committed revision 6253. 4.1.0

     
  • Mark Miesfeld

    Mark Miesfeld - 2010-12-05

    The fix for this item was in the 4.1.0 release.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks