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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
