You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Schaefer <jo...@sunstarsys.com> on 2003/11/14 19:37:30 UTC

Whitespace issue with apxs -a: activation for previously installed modules

Around line 590, apxs.in checks for a prior LoadModule
directive using:

        foreach $lmd (@lmd) {
            my $what = $opt_A ? "preparing" : "activating";
            if ($content !~ m|\n#?\s*$lmd|) {

The problem here is that the $lmd portion looks something
like "LoadModule     modules/mod_foo.c" with a FIXED number
or whitespace characters after "LoadModule". If a user adds
or deletes a few of those characters after a prior installation
of the module, the regexp will fail to match, and redundant 
LoadModule directives will appear in his/her httpd.conf.

One possible (untested) solution is substitute '\s+' for
the whitespace between "LoadModule" and "modules/mod_foo.c":

        foreach $lmd (@lmd) {
            my $what = $opt_A ? "preparing" : "activating";
            my $pattern = $lmd;
            $pattern =~ s/\s+/\\s+/;
            if ($content !~ m|\n\s+#?\s*$pattern|) {
  
Another approach would be to do nothing.  I'd be happy to
prepare a patch if this approach - to do nothing - is 
unacceptable.  Of course, suggestions to make the patch
as robust as possible would be enthusiastically welcomed.

Thanks!
-- 
Joe Schaefer


Re: Whitespace issue with apxs -a: activation for previously installed modules

Posted by Jeff Trawick <tr...@attglobal.net>.
Joe Schaefer wrote:

> Another approach would be to do nothing.

don't tell me people have been reading the "wheel of httpd-ev..." thread :)

   I'd be happy to
> prepare a patch if this approach - to do nothing - is 
> unacceptable.  Of course, suggestions to make the patch
> as robust as possible would be enthusiastically welcomed.

I don't see how allowing an arbitrary number of blanks could possibly hurt. 
Show us a tested patch.  There will be a mad rush to see which committer will 
jump on it first.  Okay, perhaps this is not the most realistic expectation ;)