You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1998/01/15 22:00:26 UTC
[PATCH] Improve implementation of -c/-Cdirective reading
*** WARNING *** THIS PATCH BREAKS MOD_PERL *** WARNING ***
The recently added -C/-c directive handling has a few bugs I didn't
notice at the time they were added:
* a "resource leak", or at least improper use of pcfg_openfile()
without the matching cfg_closefile(). [cfg_closefile() added.]
* A mis-use of the pcfg_openfile() interface which (as its name
suggests) is supposed to open a file. Instead a NULL pointer was
passed. In fact, the parms.config_file pointer was apparently simply
assigned "to calm down the compiler". [using pcfg_open_custom() now.]
* Instead of using srm_command_loop() to read from the "array based
file", the lines were extracted from the table manually and passed
to handle_command() individually (doesn't this break the nested
commands?!?) [using srm_command_loop() now]
* In pcfg_openfile(), the (debug) logging code would log an undefined
errno string and would not report on fopen() errors.
[reports potential errors _after_ opening the file now.]
* In pcfg_openfile(), an undefined file pointer would be entered into
the configfile_t structure and be returned to the caller.
[deleted.]
* Structured commands like
httpd -C '<IfModule mod_speling.c>' \
-C 'CheckSpelling On' \
-C '</IfModule>' ....
would not work because they were executed line-by-line. (Ehhmm..
I may be wrong on that. Correct me.). Now, the "memory file"
looks just like a regular config file to the config line parser.
* And finally, even devices would be considered valid input for config
file reading (/dev/zero certainly being the one with the largest
number of bytes in it).
[allowing only /dev/null as a convenience, no other devices now.]
*** WARNING *** THIS PATCH BREAKS MOD_PERL *** WARNING ***
That is because I switched to using srm_command_loop(). But the perl
hook was coded into the explicit
while (array has more lines) handle_command()
loop. I think it did NOT belong there!
Can one of the perl gurus please have a look at the proper place where
the "PerlModule" command could be checked? Is it in srm_command_loop()?
Martin
--
| S I E M E N S | <Ma...@mch.sni.de> | Siemens Nixdorf
| ------------- | Voice: +49-89-636-46021 | Informationssysteme AG
| N I X D O R F | FAX: +49-89-636-44994 | 81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
Re: [PATCH] Improve implementation of -c/-Cdirective reading (take 2)
Posted by Doug MacEachern <do...@telebusiness.co.nz>.
Martin Kraemer wrote:
> On Fri, Jan 16, 1998 at 11:24:23AM +1300, Doug MacEachern wrote:
> > +1 on concept. the patch makes one .rej files which I applied by
> > hand, but my sore eyes can't see what's wrong:
> > util.c: In function `pcfg_openfile':
> > util.c:715: parse error before `*'
> > util.c:726: `param' undeclared (first use this function)
>
> Could have been a gcc bug(I'm using a different compiler here). Anyway
> I undid the prototype beautification and #ifdef'ed the fstat code.
>
> Furthermore, I added a missing error printf and sent the whole thing
> thru indent, so here's take 2.
Sweetness. Works great, +1
-Doug
[PATCH] Improve implementation of -c/-Cdirective reading (take 2)
Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Jan 16, 1998 at 11:24:23AM +1300, Doug MacEachern wrote:
> +1 on concept. the patch makes one .rej files which I applied by
> hand, but my sore eyes can't see what's wrong:
> util.c: In function `pcfg_openfile':
> util.c:715: parse error before `*'
> util.c:726: `param' undeclared (first use this function)
Could have been a gcc bug(I'm using a different compiler here). Anyway
I undid the prototype beautification and #ifdef'ed the fstat code.
Furthermore, I added a missing error printf and sent the whole thing
thru indent, so here's take 2.
> isokay, the #ifdef MOD_PERL isn't needed anymore.
Removed that too.
Martin
--
| S I E M E N S | <Ma...@mch.sni.de> | Siemens Nixdorf
| ------------- | Voice: +49-89-636-46021 | Informationssysteme AG
| N I X D O R F | FAX: +49-89-636-44994 | 81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
Re: [PATCH] Improve implementation of -c/-Cdirective reading
Posted by Doug MacEachern <do...@telebusiness.co.nz>.
Martin Kraemer wrote:
> *** WARNING *** THIS PATCH BREAKS MOD_PERL *** WARNING ***
>
> The recently added -C/-c directive handling has a few bugs I didn't
> notice at the time they were added:
sheesh, I am cursed, I can't even apply your patch to fix all the bugs I
added ;-(+1 on concept. the patch makes one .rej files which I applied by
hand, but my sore eyes can't see what's wrong:
util.c: In function `pcfg_openfile':
util.c:715: parse error before `*'
util.c:726: `param' undeclared (first use this function)
util.c:726: (Each undeclared identifier is reported only once
util.c:726: for each function it appears in.)
util.c:727: `descr' undeclared (first use this function)
util.c:728: `getch' undeclared (first use this function)
util.c:729: `getstr' undeclared (first use this function)
util.c:730: `close_func' undeclared (first use this function)
It's been a long week and late night, could you just send me your util.c so I
can test?
> That is because I switched to using srm_command_loop(). But the perl
> hook was coded into the explicit
> while (array has more lines) handle_command()
> loop. I think it did NOT belong there!
>
> Can one of the perl gurus please have a look at the proper place where
> the "PerlModule" command could be checked? Is it in srm_command_loop()?
isokay, the #ifdef MOD_PERL isn't needed anymore.
-Doug
Re: [PATCH] Improve implementation of -c/-Cdirective reading
Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Thu, Jan 15, 1998 at 10:00:26PM +0100, Martin Kraemer wrote:
> * And finally, even devices would be considered valid input for config
> file reading (/dev/zero certainly being the one with the largest
> number of bytes in it).
> [allowing only /dev/null as a convenience, no other devices now.]
...and for WIN32 and _EMX_ the test should probably check for names as
"con" or "con:", "ptn", "prn:" and the like instead of S_IFREG(), or is
there an S_IFREG() in MSVC which returns FALSE for them?
What other pseudo devices besides "nul", "nul:" and the ones mentioned
above are there in Windoze?
Martin
--
| S I E M E N S | <Ma...@mch.sni.de> | Siemens Nixdorf
| ------------- | Voice: +49-89-636-46021 | Informationssysteme AG
| N I X D O R F | FAX: +49-89-636-44994 | 81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request