Steve Hay wrote:
Stas Bekman wrote:
Steve Hay wrote:
Me again!
One more test failure on the usual Win32 setup (2.0.47 / [EMAIL PROTECTED] / mp2-cvs):
=====
C:\Temp\modperl-2.0>perl t/TEST -verbose t/apr/perlio.t
C:\apache2/bin/Apache.exe -d C:/Temp/modperl-2.0/t -f C:/Temp/modperl-2.0/t/con
# testing : read/write a dupped file # expected: This is a test: 3384 # received: This is a test: 3384 not ok 10
Thanks Steve, Randy has already reported this issue, but he didn't have a chance to debug it. Can you try and see why does it prepend the space when reading from a file? e.g. test the file itself, it could be that it wrote the space in there.
You need to poke in xs/APR/PerlIO/apr_perlio.c
most likely inside: PerlIOAPR_read
Right. I've put a breakpoint on the apr_file_read() call (apr_perlio.c, line 166) so I catch the offending test as soon as it reaches the "my $received = <$dup_fh>;" bit. (The other tests are commented out.)
What I find is that when we first go inside apr_file_read(), thefile->ungetchar is 0. This makes it put that value (i.e. a null char, 0x00) into the space pointed to by buf, advances the buf pointer itself (ready for reading in the next character) and returns APR_SUCCESS.
Thus, the first character put into *(char *)vbuf by PerlIOAPR_read() is a null char. Presumably this is the problem?
(Check: Adding:
my $char = $received; $char =~ s/^(.).*$/$1/; print "First character is ", ord($char), "\n";
after the failing read produces this output:
First character is 0
i.e. it is a leading null character (0), not a space character (32).)
I don't know what to do about this. I tried slipping "apr_file_ungetc(-1, st->file);" into PerlIOAPR_open() and PerlIOAPR_dup(), but that just leads to thefile->ungetchar being set to 255 (because apr_file_ungetc() casts the supplied char to an unsigned char before assigning it!). So the ungetchar is still done since 255 != -1 either. Obviously not the way to fix it :-(
- Steve
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
