Re: [ANNOUNCE] mod_perl 2.0.0-RC6

[prev] [thread] [next] [Date index for 2005/05/05]

From: Stas Bekman
Subject: Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Date: 06:40 on 05 May 2005
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@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

(message missing)

[ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 06:26 on 04 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Octavian Rasnita 09:47 on 04 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 02:34 on 10 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Steve Hay 10:36 on 04 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Markus Wichitill 13:44 on 04 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 06:40 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Steve Hay 09:28 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 14:35 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Markus Wichitill 14:47 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Randy Kobes 15:25 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Steve Hay 16:00 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Markus Wichitill 16:13 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Randy Kobes 16:54 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Steve Hay 17:08 on 05 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 05:27 on 06 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Randy Kobes 05:40 on 06 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Markus Wichitill 10:11 on 06 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Steve Hay 10:31 on 06 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Randy Kobes 13:29 on 06 May 2005

Graphics / Pie Charts
David Hofmann 19:34 on 06 May 2005

Re: Graphics / Pie Charts
Sam Tregar 19:40 on 06 May 2005

Re: Graphics / Pie Charts
Hans Poo 21:01 on 06 May 2005

Re: Graphics / Pie Charts
Jeff Ambrosino 21:31 on 06 May 2005

Re: Graphics / Pie Charts
Jay Scherrer 23:57 on 06 May 2005

Re: Graphics / Pie Charts
Foo Ji-Haw 05:47 on 07 May 2005

Re: Graphics / Pie Charts
Tom Schindl 13:07 on 07 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Tom Williams 19:43 on 07 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 07:16 on 08 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Tom Williams 14:21 on 08 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 15:11 on 08 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 02:00 on 10 May 2005

Re: [ANNOUNCE] mod_perl 2.0.0-RC6
Stas Bekman 06:50 on 07 May 2005

Generated at 06:57 on 17 May 2005 by mariachi v0.52