You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Steve Hay <st...@uk.radan.com> on 2003/09/17 11:25:08 UTC

[mp2] t/apr/perlio.t test failure

Me again!

One more test failure on the usual Win32 setup (2.0.47 / 5.8.1@21233 / 
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
f/httpd.conf -DAPACHE2 -DPERL_USEITHREADS
using Apache/2.0.47 (winnt MPM)
[snip]
apr/perlio....1..12
# Running under perl version 5.008001 for MSWin32
# Current time local: Wed Sep 17 09:50:44 2003
# Current time GMT:   Wed Sep 17 08:50:44 2003
# Using Test.pm version 1.24
# open file C:\Temp\modperl-2.0\t\htdocs\perlio\test for writing
ok 1
# write to a file:
# This is a test: 3384
# testing : expected failure
# expected: No such file or directory
# received: No such file or directory
ok 2
ok 3
# testing : single line read
# expected: This is a test: 3384
# received: This is a test: 3384
ok 4
# testing : slurp file
# expected: This is a test: 3384
# -- sep --
# test line --sep two
# received: This is a test: 3384
# -- sep --
# test line --sep two
ok 5
# testing : custom complex input record sep read
# expected: [
#     This is a test: 3384
# -- sep --
# ,
#     test line --sep two
# ,
# ]
# received: [
#     This is a test: 3384
# -- sep --
# ,
#     test line --sep two
# ,
# ]
ok 6
# testing : not end of file
# expected: 0
# received: 0
ok 7
# testing : end of file
# expected: 1
# received: 1
ok 8
ok 9
# testing : read/write a dupped file
# expected: This is a test: 3384
# received:  This is a test: 3384
not ok 10
# testing : file unbuffered write
# expected: This is an un buffering write test
# received: This is an un buffering write test
ok 11
# testing : file buffered write
# expected: undef
# received: undef
ok 12
FAILED test 10
        Failed 1/12 tests, 91.67% okay
Failed Test  Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
apr/perlio.t               12    1   8.33%  10
!!! error running tests (please examine t\logs\error_log)
=====

Nothing interesting in the error_log.

- Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [RESOLVED] Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Stas Bekman wrote:
> 
>>> Shall I leave you to submit that to the Apache guys, then, seeing as 
>>> you cracked it?
>>
>>
>>
>> Unfortunately I have a commit access to apr, so they would expect me 
>> to exercise it. I'll commit it and disable that test on win32 untill 
>> the next version is released.
> 
> 
> now committed, hopefully it'll make it into httpd-2.0.48

I've also changed the test to skip the dup file sub-test if win32 and httpd < 
2.0.48, now committed.

Index: t/response/TestAPR/perlio.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v
retrieving revision 1.24
diff -u -r1.24 perlio.pm
--- t/response/TestAPR/perlio.pm        4 Sep 2003 04:34:05 -0000       1.24
+++ t/response/TestAPR/perlio.pm        19 Sep 2003 19:53:46 -0000
@@ -19,13 +19,18 @@
  #XXX: you can set to zero if largefile support is not enabled in Perl
  use constant LARGE_FILES_CONFLICT => 1;

+# apr_file_dup has a bug on win32,
+# should be fixed in apr 0.9.4 / httpd-2.0.48
+require Apache::Build;
+use constant APR_WIN32_FILE_DUP_BUG =>
+    Apache::Build::WIN32() && !have_min_apache_version('2.0.48');
+
  sub handler {
      my $r = shift;

-    my $tests = 12;
-    my $lfs_tests = 3;
-
-    $tests += $lfs_tests unless LARGE_FILES_CONFLICT;
+    my $tests = 11;
+    $tests += 3 unless LARGE_FILES_CONFLICT;
+    $tests += 1 unless APR_WIN32_FILE_DUP_BUG;

      require APR::PerlIO;
      plan $r, tests => $tests,
@@ -180,9 +185,11 @@
          my $received = <$dup_fh>;

          close $dup_fh;
-        ok t_cmp($expected,
-                 $received,
-                 "read/write a dupped file");
+        unless (APR_WIN32_FILE_DUP_BUG) {
+            ok t_cmp($expected,
+                     $received,
+                     "read/write a dupped file");
+        }
      }

      # unbuffered write


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [RESOLVED] Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:

>> Shall I leave you to submit that to the Apache guys, then, seeing as 
>> you cracked it?
> 
> 
> Unfortunately I have a commit access to apr, so they would expect me to 
> exercise it. I'll commit it and disable that test on win32 untill the 
> next version is released.

now committed, hopefully it'll make it into httpd-2.0.48

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [RESOLVED] Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:

> Excellent - your patch (below) fixes this test:
> 
> C:\Temp\modperl-2.0>perl t/TEST -verbose t/apr/perlio.t
> ...
> # testing : read/write a dupped file
> # expected: This is a test: 2108
> # received: This is a test: 2108
> ok 10
> ...
> 
> (and the rest of the testsuite (skipping filter, hooks and modules) also 
> still passes OK too).

Excellent! One bug down.

 From comparing the apr dup functions for win32 and unix, it seems that there 
could be a few other things that aren't dupped on win32. at least that's how I 
found the bug. it's not the first time mod_perl test suite finds a bug in apr. 
I wish theirs had a better test suite.

> Shall I leave you to submit that to the Apache guys, then, seeing as you 
> cracked it?

Unfortunately I have a commit access to apr, so they would expect me to 
exercise it. I'll commit it and disable that test on win32 untill the next 
version is released.

>> Index: apr/file_io/win32/filedup.c
>> ===================================================================
>> RCS file: /home/cvspublic/apr/file_io/win32/filedup.c,v
>> retrieving revision 1.54
>> diff -u -r1.54 filedup.c
>> --- apr/file_io/win32/filedup.c 7 Jan 2003 00:52:53 -0000       1.54
>> +++ apr/file_io/win32/filedup.c 18 Sep 2003 21:13:11 -0000
>> @@ -81,7 +81,8 @@
>>      (*new_file)->fname = apr_pstrdup(p, old_file->fname);
>>      (*new_file)->append = old_file->append;
>>      (*new_file)->buffered = FALSE;
>> -
>> +    (*new_file)->ungetchar = old_file->ungetchar;
>> +
>>      apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), 
>> file_cleanup,
>>                          apr_pool_cleanup_null);
>>
>> @@ -150,6 +151,7 @@
>>      new_file->fname = apr_pstrdup(new_file->pool, old_file->fname);
>>      new_file->append = old_file->append;
>>      new_file->buffered = FALSE;
>> +    new_file->ungetchar = old_file->ungetchar;
>>
>>      return APR_SUCCESS;
>>  #endif /* !defined(_WIN32_WCE) */ 
> 
> 
> 


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


[RESOLVED] Re: [mp2] t/apr/perlio.t test failure

Posted by Steve Hay <st...@uk.radan.com>.
Stas Bekman wrote:

> Steve Hay wrote:
>
>> Stas Bekman wrote:
>>
>>> Steve Hay wrote:
>>>
>>>> Stas Bekman wrote:
>>>>
>>>>> Steve Hay wrote:
>>>>>
>>>>>> Me again!
>>>>>>
>>>>>> One more test failure on the usual Win32 setup (2.0.47 / 
>>>>>> 5.8.1@21233 / 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 :-(
>
>
> very nice ;) looks like a bug in apr, obviously untested : 

Excellent - your patch (below) fixes this test:

C:\Temp\modperl-2.0>perl t/TEST -verbose t/apr/perlio.t
...
# testing : read/write a dupped file
# expected: This is a test: 2108
# received: This is a test: 2108
ok 10
...

(and the rest of the testsuite (skipping filter, hooks and modules) also 
still passes OK too).

Shall I leave you to submit that to the Apache guys, then, seeing as you 
cracked it?

- Steve

>
>
> Index: apr/file_io/win32/filedup.c
> ===================================================================
> RCS file: /home/cvspublic/apr/file_io/win32/filedup.c,v
> retrieving revision 1.54
> diff -u -r1.54 filedup.c
> --- apr/file_io/win32/filedup.c 7 Jan 2003 00:52:53 -0000       1.54
> +++ apr/file_io/win32/filedup.c 18 Sep 2003 21:13:11 -0000
> @@ -81,7 +81,8 @@
>      (*new_file)->fname = apr_pstrdup(p, old_file->fname);
>      (*new_file)->append = old_file->append;
>      (*new_file)->buffered = FALSE;
> -
> +    (*new_file)->ungetchar = old_file->ungetchar;
> +
>      apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), 
> file_cleanup,
>                          apr_pool_cleanup_null);
>
> @@ -150,6 +151,7 @@
>      new_file->fname = apr_pstrdup(new_file->pool, old_file->fname);
>      new_file->append = old_file->append;
>      new_file->buffered = FALSE;
> +    new_file->ungetchar = old_file->ungetchar;
>
>      return APR_SUCCESS;
>  #endif /* !defined(_WIN32_WCE) */ 




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
> Stas Bekman wrote:
> 
>> Steve Hay wrote:
>>
>>> Stas Bekman wrote:
>>>
>>>> Steve Hay wrote:
>>>>
>>>>> Me again!
>>>>>
>>>>> One more test failure on the usual Win32 setup (2.0.47 / 
>>>>> 5.8.1@21233 / 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 :-(

very nice ;) looks like a bug in apr, obviously untested :

Index: apr/file_io/win32/filedup.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/win32/filedup.c,v
retrieving revision 1.54
diff -u -r1.54 filedup.c
--- apr/file_io/win32/filedup.c 7 Jan 2003 00:52:53 -0000       1.54
+++ apr/file_io/win32/filedup.c 18 Sep 2003 21:13:11 -0000
@@ -81,7 +81,8 @@
      (*new_file)->fname = apr_pstrdup(p, old_file->fname);
      (*new_file)->append = old_file->append;
      (*new_file)->buffered = FALSE;
-
+    (*new_file)->ungetchar = old_file->ungetchar;
+
      apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), 
file_cleanup,
                          apr_pool_cleanup_null);

@@ -150,6 +151,7 @@
      new_file->fname = apr_pstrdup(new_file->pool, old_file->fname);
      new_file->append = old_file->append;
      new_file->buffered = FALSE;
+    new_file->ungetchar = old_file->ungetchar;

      return APR_SUCCESS;
  #endif /* !defined(_WIN32_WCE) */


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Steve Hay <st...@uk.radan.com>.
Stas Bekman wrote:

> Steve Hay wrote:
>
>> Stas Bekman wrote:
>>
>>> Steve Hay wrote:
>>>
>>>> Me again!
>>>>
>>>> One more test failure on the usual Win32 setup (2.0.47 / 
>>>> 5.8.1@21233 / 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: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
[...]
> I'm not sure I understand your point.  I'm aware that that you can write 
> '<:APR' without loading any module yourself and Perl will take care of 
> it for you.  Fine.  But the PerlIO manpage says that the module that 
> will be loaded for you is, in this case, PerlIO::APR.  I don't see any 
> such module -- there is an APR::PerlIO, but no PerlIO::APR.

it can be named in any way you want, since what matters is how the module 
registers its layer name. Since this is not a standalone module but an 
interface to APR:: it's called APR::PerlIO.

>> You need to poke in xs/APR/PerlIO/apr_perlio.c
>> most likely inside: PerlIOAPR_read
>>
>> however there is also the tracing option, before you try to step 
>> through with debugger. Try running the test with the 'o' option (o == 
>> IO):
>>
>> env MOD_PERL_TRACE=o t/TEST -v apr/perlio
>>
>> also you probably want to comment out the rest of the sub-tests in 
>> that file so they won't stand on your way. 
> 
> 
> [After rebuilding mp2 with MP_TRACE=1, which I didn't at first realise I 
> needed to do!...]

> This doesn't seem to produce any debug at all, other than a short dump 
> of what the trace options are (confirming that I/O is selected).
> 
> Weird.  There is an MP_TRACE_o() call in PerlIOAPR_read().  I can walk 
> through it in the debugger -- it *does* call modperl_trace() and 
> apparently write stuff out, but it never appears in the error_log.

Can you step through to the write and see why it doesn't show up in the 
error_log file?

> Do other folks have any success using MOD_PERL_TRACE=o on Win32?

May be the whole tracing is not working on win32? Can you trace other things? 
e.g. =f for filters? See:
http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlTrace_
I think Randy has reported successful tracing before.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Steve Hay <st...@uk.radan.com>.
Stas Bekman wrote:

> Steve Hay wrote:
>
>> Stas Bekman wrote:
>>
>>> Steve Hay wrote:
>>>
>>>> Me again!
>>>>
>>>> One more test failure on the usual Win32 setup (2.0.47 / 
>>>> 5.8.1@21233 / 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. 
>>
>>
>>
>> I changed the test script a little so that the later tests use a 
>> different filename.  That way, the file doesn't get overwritten, and 
>> since there is no cleanup at the end that means it is left behind for 
>> me to look at.
>>
>> The file does not have the leading space character that the test 
>> reports having received.
>>
>> I'm a little confused how the open()'s work.  I thought
>>
>>    open my $fh, "<:APR", $file, ...
>>
>> would do
>>
>>    use PerlIO 'APR';
>>
>> and hence
>>
>>    require PerlIO::APR;
>>
>> (see PerlIO manpage), but I can't see a PerlIO::APR module - only an 
>> APR::PerlIO.  Is that what it's using?  If so, how?
>>
>> So is xs\APR\PerlIO\ tha right place to be poking around?
>
>
> it pushed that layer internally via open. Just like you can say:
>
>  open my $fh, "<:utf8", $file ...
>
> without loading utf8.pm, see 'perldoc -f open'. 

I'm not sure I understand your point.  I'm aware that that you can write 
'<:APR' without loading any module yourself and Perl will take care of 
it for you.  Fine.  But the PerlIO manpage says that the module that 
will be loaded for you is, in this case, PerlIO::APR.  I don't see any 
such module -- there is an APR::PerlIO, but no PerlIO::APR.

>
>
> You need to poke in xs/APR/PerlIO/apr_perlio.c
> most likely inside: PerlIOAPR_read
>
> however there is also the tracing option, before you try to step 
> through with debugger. Try running the test with the 'o' option (o == 
> IO):
>
> env MOD_PERL_TRACE=o t/TEST -v apr/perlio
>
> also you probably want to comment out the rest of the sub-tests in 
> that file so they won't stand on your way. 

[After rebuilding mp2 with MP_TRACE=1, which I didn't at first realise I 
needed to do!...]

This doesn't seem to produce any debug at all, other than a short dump 
of what the trace options are (confirming that I/O is selected).

Weird.  There is an MP_TRACE_o() call in PerlIOAPR_read().  I can walk 
through it in the debugger -- it *does* call modperl_trace() and 
apparently write stuff out, but it never appears in the error_log.

Do other folks have any success using MOD_PERL_TRACE=o on Win32?

- Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
> Stas Bekman wrote:
> 
>> Steve Hay wrote:
>>
>>> Me again!
>>>
>>> One more test failure on the usual Win32 setup (2.0.47 / 5.8.1@21233 
>>> / 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. 
> 
> 
> I changed the test script a little so that the later tests use a 
> different filename.  That way, the file doesn't get overwritten, and 
> since there is no cleanup at the end that means it is left behind for me 
> to look at.
> 
> The file does not have the leading space character that the test reports 
> having received.
> 
> I'm a little confused how the open()'s work.  I thought
> 
>    open my $fh, "<:APR", $file, ...
> 
> would do
> 
>    use PerlIO 'APR';
> 
> and hence
> 
>    require PerlIO::APR;
> 
> (see PerlIO manpage), but I can't see a PerlIO::APR module - only an 
> APR::PerlIO.  Is that what it's using?  If so, how?
> 
> So is xs\APR\PerlIO\ tha right place to be poking around?

it pushed that layer internally via open. Just like you can say:

  open my $fh, "<:utf8", $file ...

without loading utf8.pm, see 'perldoc -f open'.

You need to poke in xs/APR/PerlIO/apr_perlio.c
most likely inside: PerlIOAPR_read

however there is also the tracing option, before you try to step through with 
debugger. Try running the test with the 'o' option (o == IO):

env MOD_PERL_TRACE=o t/TEST -v apr/perlio

also you probably want to comment out the rest of the sub-tests in that file 
so they won't stand on your way.

Also while you debug it see if the current tracing is good enough in 
apr_perlio.c, we might need to add more tracing if some important things 
aren't traced.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Steve Hay <st...@uk.radan.com>.
Stas Bekman wrote:

> Steve Hay wrote:
>
>> Me again!
>>
>> One more test failure on the usual Win32 setup (2.0.47 / 5.8.1@21233 
>> / 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. 

I changed the test script a little so that the later tests use a 
different filename.  That way, the file doesn't get overwritten, and 
since there is no cleanup at the end that means it is left behind for me 
to look at.

The file does not have the leading space character that the test reports 
having received.

I'm a little confused how the open()'s work.  I thought

    open my $fh, "<:APR", $file, ...

would do

    use PerlIO 'APR';

and hence

    require PerlIO::APR;

(see PerlIO manpage), but I can't see a PerlIO::APR module - only an 
APR::PerlIO.  Is that what it's using?  If so, how?

So is xs\APR\PerlIO\ tha right place to be poking around?

- Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] t/apr/perlio.t test failure

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
> Me again!
> 
> One more test failure on the usual Win32 setup (2.0.47 / 5.8.1@21233 / 
> 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.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org