I think this is a reproducer for the problem that occasionally
inserts spurious carriage returns into what should be one line of
output in the test suite. It appears to be a function of pipe buffer
size. If the mailbox buffer for a pipe fills up, reading EOF from
the pipe causes a carriage return to get inserted in the stream.
Perhaps we've been through all this before, but I keep forgetting
exactly what the problem is. I 've looked at the piping code and
don't see right off why this is happening, but there's some pretty
twisty stuff in there. We could dodge the most common occurrences by
defaulting to a buffer larger than the current 512, but that caused
some people BYTLM problems. Hmm, perhaps when Chuck gets through
grading exams for the semester he'll have a eureka experience on this
:-).
The script:
$ type test_pipe_overflow.pl
open (A, qq/$^X -e "\@a=(1..200); print \@a;" |/) or die $!;
while (<A>) {print;}
$ define perl_mbx_size 128
%DCL-I-SUPERSEDE, previous value of PERL_MBX_SIZE has been superseded
$ perl test_pipe_overflow.pl
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686
97071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211
22123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
$ define perl_mbx_size 256
%DCL-I-SUPERSEDE, previous value of PERL_MBX_SIZE has been superseded
$ perl test_pipe_overflow.pl
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211
22123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
--
____________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]
"Literary critics usually know what they're
talking about. Even if they're wrong."
-- Perl creator Larry Wall