You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Steve Hay <st...@uk.radan.com> on 2005/05/04 12:36:35 UTC

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Stas Bekman wrote:

>The uploaded file
>
>     mod_perl-2.0.0-RC6.tar.gz
>
>has entered CPAN
>
Almost all OK on Win32 (Apache 2.0.54 and a recent bleadperl).  Main 
tests are all successful, but ModPerl-Registry tests failed 404.t test 1 
and redirect.t test 2.

The 404.t test gives the following verbose output:

t\404....1..2
# Running under perl version 5.009003 for MSWin32
# Current time local: Wed May  4 11:19:42 2005
# Current time GMT:   Wed May  4 10:19:42 2005
# Using Test.pm version 1.25
# Using Apache/Test.pm version 1.23
# Failed test 1 in t\404.t at line 14
# testing : test ErrorDocument
# expected: Oops, can't find the requested doc
# received:
not ok 1
# testing : the script has changed the status to 404
# expected: 404
# received: 404
ok 2

and writes this (only to the error_log: "*** The following error entry 
is expected and harmless ***".  The access_log seems to show a 200/OK 
rather than a 404:

127.0.0.1 - - [04/May/2005:11:28:35 +0100] "GET /index.html HTTP/1.0" 
200 956
127.0.0.1 - - [04/May/2005:11:28:37 +0100] "GET 
/error_document/cannot_be_found HTTP/1.0" 200 -
127.0.0.1 - - [04/May/2005:11:28:37 +0100] "GET 
/registry/status_change.pl HTTP/1.0" 404 223

Is that what's expected?

The redirect.t test outputs:

t\redirect....1..4
# Running under perl version 5.009003 for MSWin32
# Current time local: Wed May  4 11:21:31 2005
# Current time GMT:   Wed May  4 10:21:31 2005
# Using Test.pm version 1.25
# Using Apache/Test.pm version 1.23
# testing : test redirect: existing target
# expected: ok 
C:/apache2/source/mod_perl-2.0.0-RC6/ModPerl-Registry/t/cgi-bin/basic.pl
# received: ok 
C:/apache2/source/mod_perl-2.0.0-RC6/ModPerl-Registry/t/cgi-bin/basic.pl
ok 1
# Failed test 2 in t\redirect.t at line 32
# testing : test redirect: non-existing target
# expected: 404
# received: 200
not ok 2
# testing : test Registry style redirect: status
# expected: 302
# received: 302
ok 3
# testing : test Registry style redirect: cookie
# expected: mod_perl=ubercool; path=/
# received: mod_perl=ubercool; path=/
ok 4

and writes the same message as before (only) into the error_log.  The 
access_log again shows a 200/OK rather than a 404 as expected following 
the 302:

127.0.0.1 - - [04/May/2005:11:32:55 +0100] "GET /index.html HTTP/1.0" 
200 956
127.0.0.1 - - [04/May/2005:11:32:57 +0100] "GET 
/registry/redirect.pl?/registry/basic.pl HTTP/1.0" 302 223
127.0.0.1 - - [04/May/2005:11:32:58 +0100] "GET /registry/basic.pl 
HTTP/1.0" 200 75
127.0.0.1 - - [04/May/2005:11:32:58 +0100] "HEAD 
/registry/redirect.pl?/registry/does_not_exists.pl HTTP/1.0" 302 -
127.0.0.1 - - [04/May/2005:11:32:58 +0100] "HEAD 
/registry/does_not_exists.pl HTTP/1.0" 200 -
127.0.0.1 - - [04/May/2005:11:32:58 +0100] "HEAD 
/registry/redirect-cookie.pl?/registry/basic.pl HTTP/1.0" 302 -

Any ideas?

- Steve


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Stas Bekman <st...@stason.org>.
Steve Hay wrote:
> Stas Bekman wrote:
> 
> 
>>Markus Wichitill wrote:
>> 
>>
>>
>>>Steve Hay wrote:
>>>
>>>   
>>>
>>>
>>>>Almost all OK on Win32 (Apache 2.0.54 and a recent bleadperl).  Main 
>>>>tests are all successful, but ModPerl-Registry tests failed 404.t test 
>>>>1 and redirect.t test 2.
>>>>     
>>>>
>>>
>>>Same here (WinXP, 2.0.54, 5.8.6). modperl_slurp_filename doesn't raise a 
>>>ENOENT exception when it should. The
>>>
>>>   if (!size) {
>>>       sv_setpvn(sv, "", 0);
>>>       return newRV_noinc(sv);
>>>   }
>>>
>>>part looks fishy to me. size is 0 and therefore we never get to 
>>>SLURP_SUCCESS("opening"), which should throw the exception.
>>>   
>>>
>>
>>Hmm, please see the comment:
>>
>>    /* XXX: could have checked whether r->finfo.filehand is valid and
>>     * save the apr_file_open call, but apache gives us no API to
>>     * check whether filehand is valid. we can't test whether it's
>>     * NULL or not, as it may contain garbagea
>>     */
>>
>>how can we test if the filehandle is valid then? may be we should skip 
>>that bit altogether? Steve, does it work if you comment out the whole
>>
>>  if (!size) { ... }
>>
>>block?
>>
> 
> No, it doesn't :(
> 
> I even did a complete rebuild in case something didn't get relinked 
> properly after the change, but it still doesn't fix the two test failures.

So what has changed? You didn't have these problems with RC6? Could you 
trace what change has affected that? Unless Randy or someone who can 
reproduce that can look at the issue.

-- 
__________________________________________________________________
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

Re: Graphics / Pie Charts

Posted by Jeff Ambrosino <jb...@gmail.com>.
If, by chance, you also have use for a general purpose templating
system, I've had great luck with Template-Toolkit
(www.template-toolkit.org.)  Among [many] other things, it embeds GD
so you can write little templates that slurp in the data and produce
graphics with graphs, charts, etc.  The learning curve is heavier than
just getting a quick-and-dirty graphing module to work (ala something
you'd do in CGI), but worthwhile if you're looking to add other
functions over time.

cheers
Jeff


On 5/6/05, David Hofmann <mo...@hotmail.com> wrote:
> Someone recommend that I use GDGraph-1.43. Looking at it there hasn't been
> an update since 2003. So before I go play with it I figure I ask here if
> anyone has done and graph stuff, and if there a better module to use under
> mod perl.

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 6 May 2005, Steve Hay wrote:
> 
> 
>>Markus Wichitill wrote:
> 
> [ .. ]
> 
>>>I guess you two didn't remove the "if (!size)" check like I did?
>>>
>>
>>Shit.  How dumb am I?
>>
>>You're absolutely right -- you have to remove the size
>>check as well in order for Randy's fix to even be reached!
>>With this change in place too I now have all tests
>>successful :-)
>>
>>Thanks, Markus!
>>- Steve
> 
> 
> I forgot too to do that ... Would the following be OK?
> 
> Index: src/modules/perl/modperl_util.c
> ===================================================================
> --- src/modules/perl/modperl_util.c	(revision 168597)
> +++ src/modules/perl/modperl_util.c	(working copy)
> @@ -616,10 +616,12 @@
>      size = r->finfo.size;
>      sv = newSV(size);
> 
> +    /* allow SLURP_SUCCESS() below an opportunity to set error
>      if (!size) {
>          sv_setpvn(sv, "", 0);
>          return newRV_noinc(sv);
>      }
> +    */
> 
>      /* XXX: could have checked whether r->finfo.filehand is valid and
>       * save the apr_file_open call, but apache gives us no API to
> ==========================================================
> 
> Or would it be better to wrap the if(!size) { } within
> an #ifndef WIN32?

Why commenting out? Just remove it completely. I believe I've added it as 
an optimization, to save the open call when we know that the file size is 
zero, but it is probably not not a normal case.

I've tested the removal on linux, all tests pass.

Thanks Randy.


-- 
__________________________________________________________________
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

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 6 May 2005, Steve Hay wrote:

> Markus Wichitill wrote:
[ .. ]
> >
> >I guess you two didn't remove the "if (!size)" check like I did?
> >
> Shit.  How dumb am I?
>
> You're absolutely right -- you have to remove the size
> check as well in order for Randy's fix to even be reached!
> With this change in place too I now have all tests
> successful :-)
>
> Thanks, Markus!
> - Steve

I forgot too to do that ... Would the following be OK?

Index: src/modules/perl/modperl_util.c
===================================================================
--- src/modules/perl/modperl_util.c	(revision 168597)
+++ src/modules/perl/modperl_util.c	(working copy)
@@ -616,10 +616,12 @@
     size = r->finfo.size;
     sv = newSV(size);

+    /* allow SLURP_SUCCESS() below an opportunity to set error
     if (!size) {
         sv_setpvn(sv, "", 0);
         return newRV_noinc(sv);
     }
+    */

     /* XXX: could have checked whether r->finfo.filehand is valid and
      * save the apr_file_open call, but apache gives us no API to
==========================================================

Or would it be better to wrap the if(!size) { } within
an #ifndef WIN32?

-- 
best regards,
randy

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Steve Hay <st...@uk.radan.com>.
Markus Wichitill wrote:

>Randy Kobes wrote:
>  
>
>>>Randy, if you spot locations in docs and tests that do a comparison with
>>>these two constants, which we will now have right, please adjust those.
>>>Thank you!
>>>      
>>>
>>Thanks, Stas. I've done that, but unfortunately, like Steve,
>>I'm also finding these 2 tests still have problems :( I'll
>>keep looking ...
>>    
>>
>
>I guess you two didn't remove the "if (!size)" check like I did?
>
Shit.  How dumb am I?

You're absolutely right -- you have to remove the size check as well in 
order for Randy's fix to even be reached!  With this change in place too 
I now have all tests successful :-)

Thanks, Markus!
- Steve



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Markus Wichitill <ma...@gmx.de>.
Randy Kobes wrote:
>>Randy, if you spot locations in docs and tests that do a comparison with
>>these two constants, which we will now have right, please adjust those.
>>Thank you!
> 
> Thanks, Stas. I've done that, but unfortunately, like Steve,
> I'm also finding these 2 tests still have problems :( I'll
> keep looking ...

I guess you two didn't remove the "if (!size)" check like I did?

Re: Graphics / Pie Charts

Posted by Hans Poo <ha...@opensource.cl>.
I don't know if it's too much for a posting but, i 've just build a module
under mod_perl to do just that, i call whenever i need a pie chart. You call
it like this:

First you put a handler in httpd.conf:
--------------------------------------
<Files grafico>
     SetHandler  perl-script
     PerlHandler UB::Grafico
</Files>

The calling url is:
-------------------
http://www.ubpf.cl:8080/grafico?labels=e,c,b;values=1,3,3;title=

the module is:
--------------
package UB::Grafico;
                                                                             
                                                                               
use Apache::Constants qw/OK/;
                                                                             
                                                                               
use CGI ':standard';
use GD::Graph::pie;
use strict;
                                                                             
                                                                               
sub handler {
                                                                             
                                                                               
my $r = shift;
                                                                             
                                                                               
$r->no_cache(1);
                                                                             
                                                                               
my @labels = split /,/, param("labels");
my @values = split /,/, param("values");
                                                                             
                                                                               
# Both the arrays should same number of entries.
my @data = (\@labels, \@values);
                                                                             
                                                                               
my $mygraph = GD::Graph::pie->new(80, 80);
$mygraph->set(
    title       => param("title"),
    '3d'          => 1,
) or warn $mygraph->error;
                                                                             
                                                                               
$mygraph->set_title_font(GD::gdTinyFont);
$mygraph->set_value_font(GD::gdTinyFont);
$mygraph->set(dclrs => [ qw(yellow red cyan) ] );
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
                                                                             
                                                                               
$r->send_http_header("image/png");
print $myimage->png;
                                                                             
                                                                               
return OK;
                                                                             
                                                                               
                                                                             
                                                                               
}
                                                                             
                                                                               
1;


Good Luck
Hans

On Fri, 6 May 2005 15:40:40 -0400 (EDT), Sam Tregar wrote
> On Fri, 6 May 2005, David Hofmann wrote:
> 
> > Someone recommend that I use GDGraph-1.43. Looking at it there
> > hasn't been an update since 2003. So before I go play with it I
> > figure I ask here if anyone has done and graph stuff, and if there a
> > better module to use under mod perl.
> 
> I asked a similar question on PerlMonks recently:
> 
>   http://perlmonks.org/?node_id=452166
> 
> I ended up settling on GD::Graph3D but I'll be interested to see if
> someone here has a better idea.
> 
> -ssam


------------------------------------------------------------------------
El problema de fondo es diseñar soluciones elegantes e inteligentes, las 
herramientas sólo son las herramientas.

Hans Poo, http://hans.opensource.cl, hans@opensource.cl, F: 09-319.93.05
Consultor Linux, Desarrollo Web OpenSource.
Santiago, Chile


Re: Graphics / Pie Charts

Posted by Sam Tregar <sa...@tregar.com>.
On Fri, 6 May 2005, David Hofmann wrote:

> Someone recommend that I use GDGraph-1.43. Looking at it there
> hasn't been an update since 2003. So before I go play with it I
> figure I ask here if anyone has done and graph stuff, and if there a
> better module to use under mod perl.

I asked a similar question on PerlMonks recently:

  http://perlmonks.org/?node_id=452166

I ended up settling on GD::Graph3D but I'll be interested to see if
someone here has a better idea.

-ssam

Re: Graphics / Pie Charts

Posted by Tom Schindl <to...@gmx.at>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

1. Perl-based: Use SVG and then convert them using Image::LibRSVG to
generate PNGs
2. Use PHP and the great module Image_Graph module from
http://pear.veggerby.dk/samples/

Tom

David Hofmann schrieb:
| In order to provided stat data on my companies website my boss has asked
| me to write a program that pulls stat data from our database and display
| it on a page in graphs and pie charts. He'd like the program to hand the
| abilty to up the minute request, so I have to generate them on the fly.
|
| The database side I can do eaily. However I haven't ever played with
| graphs and charts.
|
| Someone recommend that I use GDGraph-1.43. Looking at it there hasn't
| been an update since 2003. So before I go play with it I figure I ask
| here if anyone has done and graph stuff, and if there a better module to
| use under mod perl.
|
| Thanks,
|
| David
|
| _________________________________________________________________
| Don?t just search. Find. Check out the new MSN Search!
| http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCfL2UkVPeOFLgZFIRAvQhAKCZKxwSal9y8Psq1i3r7p6WUY6KvgCbB0P0
cD1dBsshvUxI2PaxczQGlkA=
=Ug6O
-----END PGP SIGNATURE-----

Re: Graphics / Pie Charts

Posted by Jay Scherrer <ja...@scherrer.com>.
Both GTK+ and Perl::TK work really well. Using Perl GTK+ can actually
manipulate graphics through the Gimp.

Jay Scherrer

On Fri, 2005-05-06 at 15:34 -0400, David Hofmann wrote:
> In order to provided stat data on my companies website my boss has asked me 
> to write a program that pulls stat data from our database and display it on 
> a page in graphs and pie charts. He'd like the program to hand the abilty to 
> up the minute request, so I have to generate them on the fly.
> 
> The database side I can do eaily. However I haven't ever played with graphs 
> and charts.
> 
> Someone recommend that I use GDGraph-1.43. Looking at it there hasn't been 
> an update since 2003. So before I go play with it I figure I ask here if 
> anyone has done and graph stuff, and if there a better module to use under 
> mod perl.
> 
> Thanks,
> 
> David
> 
> _________________________________________________________________
> Dont just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> 


Re: Graphics / Pie Charts

Posted by Foo Ji-Haw <jh...@nexlabs.com>.
You can try ImageMagick. Very nicely done.

David Hofmann wrote:

> In order to provided stat data on my companies website my boss has 
> asked me to write a program that pulls stat data from our database and 
> display it on a page in graphs and pie charts. He'd like the program 
> to hand the abilty to up the minute request, so I have to generate 
> them on the fly.
>
> The database side I can do eaily. However I haven't ever played with 
> graphs and charts.
>
> Someone recommend that I use GDGraph-1.43. Looking at it there hasn't 
> been an update since 2003. So before I go play with it I figure I ask 
> here if anyone has done and graph stuff, and if there a better module 
> to use under mod perl.
>
> Thanks,
>
> David
>
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>

Graphics / Pie Charts

Posted by David Hofmann <mo...@hotmail.com>.
In order to provided stat data on my companies website my boss has asked me 
to write a program that pulls stat data from our database and display it on 
a page in graphs and pie charts. He'd like the program to hand the abilty to 
up the minute request, so I have to generate them on the fly.

The database side I can do eaily. However I haven't ever played with graphs 
and charts.

Someone recommend that I use GDGraph-1.43. Looking at it there hasn't been 
an update since 2003. So before I go play with it I figure I ask here if 
anyone has done and graph stuff, and if there a better module to use under 
mod perl.

Thanks,

David

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 5 May 2005, Stas Bekman wrote:

> Randy Kobes wrote:
> [...]
> > Does the following fix this?
> >
> > ===================================================================
> > Index: xs/APR/Status/APR__Status.h
> > ===================================================================
> > --- xs/APR/Status/APR__Status.h	(revision 168337)
> > +++ xs/APR/Status/APR__Status.h	(working copy)
> > @@ -16,3 +16,5 @@
> >  #include "apr_errno.h"
> >
> >  #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
> > +#define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
> > +#define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT
>
> +1
>
> Randy, if you spot locations in docs and tests that do a comparison with
> these two constants, which we will now have right, please adjust those.
> Thank you!

Thanks, Stas. I've done that, but unfortunately, like Steve,
I'm also finding these 2 tests still have problems :( I'll
keep looking ...

-- 
best regards,
randy

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
[...]
> Does the following fix this?
> 
> ===================================================================
> Index: xs/APR/Status/APR__Status.h
> ===================================================================
> --- xs/APR/Status/APR__Status.h	(revision 168337)
> +++ xs/APR/Status/APR__Status.h	(working copy)
> @@ -16,3 +16,5 @@
>  #include "apr_errno.h"
> 
>  #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
> +#define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
> +#define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT

+1

Randy, if you spot locations in docs and tests that do a comparison with 
these two constants, which we will now have right, please adjust those. 
Thank you!

-- 
__________________________________________________________________
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

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Markus Wichitill <ma...@gmx.de>.
Steve Hay wrote:
>>>I've removed the size code, too, and the problem is that after the exception
>>>is thrown, neither of the tests in RegistryCooker::read_script apply:
>>>
>>>        if (ref $@ eq 'APR::Error') {
>>>            return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
>>>            return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
>>>            # oops
>>>        }
>>>
>>>The actual error code returned by apr_file_open is 720002.
>>
>>Does the following fix this?
> 
> No.  I was just in the process of trying the same thing myself, but it 
> doesn't fix it for me :(

Works for me, though.

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>On Thu, 5 May 2005, Steve Hay wrote:
>
>  
>
>>Randy Kobes wrote:
>>
>>    
>>
>>>On Thu, 5 May 2005, Markus Wichitill wrote:
>>>      
>>>
>[ ... ]
>  
>
>>>>The actual error code returned by apr_file_open is 720002.
>>>>        
>>>>
>>>Does the following fix this?
>>>
>>>      
>>>
>>No.  I was just in the process of trying the same thing
>>myself, but it doesn't fix it for me :(
>>    
>>
>
>You probably have to 'nmake clean', then rebuild, for these
>changes to propagate - does that work?
>
No :-s

Just did a complete rebuild:  Extracted RC6 afresh, applied your patch 
again.  Double-checked it applied correctly.  Retested.  Still get the 
same two test failures.

Now I'm really confused.

If I have a chance tomorrow, I'll have a closer look at what the 
offending $@ is on my system, but I'm off now...



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 5 May 2005, Steve Hay wrote:

> Randy Kobes wrote:
>
> >On Thu, 5 May 2005, Markus Wichitill wrote:
[ ... ]
> >>The actual error code returned by apr_file_open is 720002.
> >
> >Does the following fix this?
> >
> No.  I was just in the process of trying the same thing
> myself, but it doesn't fix it for me :(

You probably have to 'nmake clean', then rebuild, for these
changes to propagate - does that work?

-- 
best regards,
randy

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>On Thu, 5 May 2005, Markus Wichitill wrote:
>
>  
>
>>Steve Hay wrote:
>>    
>>
>>>>how can we test if the filehandle is valid then? may be we should skip
>>>>that bit altogether? Steve, does it work if you comment out the whole
>>>>
>>>> if (!size) { ... }
>>>>
>>>>block?
>>>>        
>>>>
>>>No, it doesn't :(
>>>      
>>>
>>I've removed the size code, too, and the problem is that after the exception
>>is thrown, neither of the tests in RegistryCooker::read_script apply:
>>
>>         if (ref $@ eq 'APR::Error') {
>>             return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
>>             return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
>>             # oops
>>         }
>>
>>The actual error code returned by apr_file_open is 720002.
>>
>>    
>>
>
>Does the following fix this?
>  
>
No.  I was just in the process of trying the same thing myself, but it 
doesn't fix it for me :(


>===================================================================
>Index: xs/APR/Status/APR__Status.h
>===================================================================
>--- xs/APR/Status/APR__Status.h	(revision 168337)
>+++ xs/APR/Status/APR__Status.h	(working copy)
>@@ -16,3 +16,5 @@
> #include "apr_errno.h"
>
> #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
>+#define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
>+#define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT
>Index: xs/maps/apr_functions.map
>===================================================================
>--- xs/maps/apr_functions.map	(revision 168337)
>+++ xs/maps/apr_functions.map	(working copy)
>@@ -649,3 +649,5 @@
>
> MODULE=APR::Status      PREFIX=mpxs_APR__STATUS_
>  int:DEFINE_is_EAGAIN | | apr_status_t:rc
>+ int:DEFINE_is_EACCES | | apr_status_t:rc
>+ int:DEFINE_is_ENOENT | | apr_status_t:rc
>Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
>===================================================================
>--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	(revision 168337)
>+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	(working copy)
>@@ -34,6 +34,7 @@
> use Apache2::Access ();
>
> use APR::Table ();
>+use APR::Status ();
>
> use ModPerl::Util ();
> use ModPerl::Global ();
>@@ -41,7 +42,6 @@
> use File::Spec::Functions ();
> use File::Basename;
>
>-use APR::Const     -compile => qw(EACCES ENOENT);
> use Apache2::Const  -compile => qw(:common &OPT_EXECCGI);
> use ModPerl::Const -compile => 'EXIT';
>
>@@ -542,8 +542,8 @@
>         $self->log_error("$@");
>
>         if (ref $@ eq 'APR::Error') {
>-            return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
>-            return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
>+            return Apache2::Const::FORBIDDEN if APR::Status::is_EACCES($@);
>+            return Apache2::Const::NOT_FOUND if APR::Status::is_ENOENT($@);
>         }
>         else {
>             return Apache2::Const::SERVER_ERROR;
>
>========================================================================
>
>  
>



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 5 May 2005, Markus Wichitill wrote:

> Steve Hay wrote:
> >>how can we test if the filehandle is valid then? may be we should skip
> >>that bit altogether? Steve, does it work if you comment out the whole
> >>
> >>  if (!size) { ... }
> >>
> >>block?
> >
> > No, it doesn't :(
>
> I've removed the size code, too, and the problem is that after the exception
> is thrown, neither of the tests in RegistryCooker::read_script apply:
>
>          if (ref $@ eq 'APR::Error') {
>              return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
>              return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
>              # oops
>          }
>
> The actual error code returned by apr_file_open is 720002.
>

Does the following fix this?

===================================================================
Index: xs/APR/Status/APR__Status.h
===================================================================
--- xs/APR/Status/APR__Status.h	(revision 168337)
+++ xs/APR/Status/APR__Status.h	(working copy)
@@ -16,3 +16,5 @@
 #include "apr_errno.h"

 #define mpxs_APR__Status_is_EAGAIN APR_STATUS_IS_EAGAIN
+#define mpxs_APR__Status_is_EACCES APR_STATUS_IS_EACCES
+#define mpxs_APR__Status_is_ENOENT APR_STATUS_IS_ENOENT
Index: xs/maps/apr_functions.map
===================================================================
--- xs/maps/apr_functions.map	(revision 168337)
+++ xs/maps/apr_functions.map	(working copy)
@@ -649,3 +649,5 @@

 MODULE=APR::Status      PREFIX=mpxs_APR__STATUS_
  int:DEFINE_is_EAGAIN | | apr_status_t:rc
+ int:DEFINE_is_EACCES | | apr_status_t:rc
+ int:DEFINE_is_ENOENT | | apr_status_t:rc
Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	(revision 168337)
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	(working copy)
@@ -34,6 +34,7 @@
 use Apache2::Access ();

 use APR::Table ();
+use APR::Status ();

 use ModPerl::Util ();
 use ModPerl::Global ();
@@ -41,7 +42,6 @@
 use File::Spec::Functions ();
 use File::Basename;

-use APR::Const     -compile => qw(EACCES ENOENT);
 use Apache2::Const  -compile => qw(:common &OPT_EXECCGI);
 use ModPerl::Const -compile => 'EXIT';

@@ -542,8 +542,8 @@
         $self->log_error("$@");

         if (ref $@ eq 'APR::Error') {
-            return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
-            return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
+            return Apache2::Const::FORBIDDEN if APR::Status::is_EACCES($@);
+            return Apache2::Const::NOT_FOUND if APR::Status::is_ENOENT($@);
         }
         else {
             return Apache2::Const::SERVER_ERROR;

========================================================================

-- 
best regards,
randy

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Markus Wichitill <ma...@gmx.de>.
Steve Hay wrote:
>>how can we test if the filehandle is valid then? may be we should skip 
>>that bit altogether? Steve, does it work if you comment out the whole
>>
>>  if (!size) { ... }
>>
>>block?
> 
> No, it doesn't :(

I've removed the size code, too, and the problem is that after the exception 
is thrown, neither of the tests in RegistryCooker::read_script apply:

         if (ref $@ eq 'APR::Error') {
             return Apache2::Const::FORBIDDEN if $@ == APR::Const::EACCES;
             return Apache2::Const::NOT_FOUND if $@ == APR::Const::ENOENT;
             # oops
         }

The actual error code returned by apr_file_open is 720002.

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

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

>Markus Wichitill wrote:
>  
>
>>Steve Hay wrote:
>>
>>    
>>
>>>Almost all OK on Win32 (Apache 2.0.54 and a recent bleadperl).  Main 
>>>tests are all successful, but ModPerl-Registry tests failed 404.t test 
>>>1 and redirect.t test 2.
>>>      
>>>
>>Same here (WinXP, 2.0.54, 5.8.6). modperl_slurp_filename doesn't raise a 
>>ENOENT exception when it should. The
>>
>>    if (!size) {
>>        sv_setpvn(sv, "", 0);
>>        return newRV_noinc(sv);
>>    }
>>
>>part looks fishy to me. size is 0 and therefore we never get to 
>>SLURP_SUCCESS("opening"), which should throw the exception.
>>    
>>
>
>Hmm, please see the comment:
>
>     /* XXX: could have checked whether r->finfo.filehand is valid and
>      * save the apr_file_open call, but apache gives us no API to
>      * check whether filehand is valid. we can't test whether it's
>      * NULL or not, as it may contain garbagea
>      */
>
>how can we test if the filehandle is valid then? may be we should skip 
>that bit altogether? Steve, does it work if you comment out the whole
>
>   if (!size) { ... }
>
>block?
>
No, it doesn't :(

I even did a complete rebuild in case something didn't get relinked 
properly after the change, but it still doesn't fix the two test failures.



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Stas Bekman <st...@stason.org>.
Markus Wichitill wrote:
> Steve Hay wrote:
> 
>> Almost all OK on Win32 (Apache 2.0.54 and a recent bleadperl).  Main 
>> tests are all successful, but ModPerl-Registry tests failed 404.t test 
>> 1 and redirect.t test 2.
> 
> 
> Same here (WinXP, 2.0.54, 5.8.6). modperl_slurp_filename doesn't raise a 
> ENOENT exception when it should. The
> 
>     if (!size) {
>         sv_setpvn(sv, "", 0);
>         return newRV_noinc(sv);
>     }
> 
> part looks fishy to me. size is 0 and therefore we never get to 
> SLURP_SUCCESS("opening"), which should throw the exception.

Hmm, please see the comment:

     /* XXX: could have checked whether r->finfo.filehand is valid and
      * save the apr_file_open call, but apache gives us no API to
      * check whether filehand is valid. we can't test whether it's
      * NULL or not, as it may contain garbagea
      */

how can we test if the filehandle is valid then? may be we should skip 
that bit altogether? Steve, does it work if you comment out the whole

   if (!size) { ... }

block?

Here is the complete func:

MP_INLINE SV *modperl_slurp_filename(pTHX_ request_rec *r, int tainted)
{
     SV *sv;
     apr_status_t rc;
     apr_size_t size;
     apr_file_t *file;

     size = r->finfo.size;
     sv = newSV(size);

     if (!size) {
         sv_setpvn(sv, "", 0);
         return newRV_noinc(sv);
     }

     /* XXX: could have checked whether r->finfo.filehand is valid and
      * save the apr_file_open call, but apache gives us no API to
      * check whether filehand is valid. we can't test whether it's
      * NULL or not, as it may contain garbagea
      */
     rc = apr_file_open(&file, r->filename, APR_READ|APR_BINARY,
                        APR_OS_DEFAULT, r->pool);
     SLURP_SUCCESS("opening");

     rc = apr_file_read(file, SvPVX(sv), &size);
     SLURP_SUCCESS("reading");

     MP_TRACE_o(MP_FUNC, "read %d bytes from '%s'\n", size, r->filename);

     if (r->finfo.size != size) {
         SvREFCNT_dec(sv);
         Perl_croak(aTHX_ "Error: read %d bytes, expected %d ('%s')",
                    size, r->finfo.size, r->filename);
     }

     rc = apr_file_close(file);
     SLURP_SUCCESS("closing");

     SvPVX(sv)[size] = '\0';
     SvCUR_set(sv, size);
     SvPOK_on(sv);

     if (tainted) {
         SvTAINTED_on(sv);
     }
     else {
         SvTAINTED_off(sv);
     }

     return newRV_noinc(sv);
}



-- 
__________________________________________________________________
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

Re: [ANNOUNCE] mod_perl 2.0.0-RC6

Posted by Markus Wichitill <ma...@gmx.de>.
Steve Hay wrote:
> Almost all OK on Win32 (Apache 2.0.54 and a recent bleadperl).  Main 
> tests are all successful, but ModPerl-Registry tests failed 404.t test 1 
> and redirect.t test 2.

Same here (WinXP, 2.0.54, 5.8.6). modperl_slurp_filename doesn't raise a 
ENOENT exception when it should. The

     if (!size) {
         sv_setpvn(sv, "", 0);
         return newRV_noinc(sv);
     }

part looks fishy to me. size is 0 and therefore we never get to 
SLURP_SUCCESS("opening"), which should throw the exception.