httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/support apxs.in
Date Sat, 22 Feb 2003 15:50:13 GMT
nd          2003/02/22 07:50:13

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES
               support  Tag: APACHE_2_0_BRANCH apxs.in
  Log:
  insert LoadModule directives only outside of sections.
  
  PR: 8712, 9012
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.988.2.38 +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.37
  retrieving revision 1.988.2.38
  diff -u -r1.988.2.37 -r1.988.2.38
  --- CHANGES	22 Feb 2003 15:21:03 -0000	1.988.2.37
  +++ CHANGES	22 Feb 2003 15:50:12 -0000	1.988.2.38
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.45
   
  +  *) Fix apxs to insert LoadModule directives only outside of sections.
  +     PR 8712, 9012.  [André Malo]
  +
     *) Fix suexec compile error under SUNOS4, where strerror() doesn't
        exist. PR 5913, 9977.
        [Jonathan W Miner <Jonathan.W.Miner@lmco.com>]
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.47.2.3  +62 -2     httpd-2.0/support/apxs.in
  
  Index: apxs.in
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/apxs.in,v
  retrieving revision 1.47.2.2
  retrieving revision 1.47.2.3
  diff -u -r1.47.2.2 -r1.47.2.3
  --- apxs.in	3 Feb 2003 17:32:09 -0000	1.47.2.2
  +++ apxs.in	22 Feb 2003 15:50:13 -0000	1.47.2.3
  @@ -579,9 +579,69 @@
           foreach $lmd (@lmd) {
               my $what = $opt_A ? "preparing" : "activating";
               if ($content !~ m|\n#?\s*$lmd|) {
  -                 $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg;
  +                # check for open <containers>, so that the new LoadModule
  +                # directive always appears *outside* of an <container>.
  +
  +                my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0];
  +
  +                # the '()=' trick forces list context and the scalar
  +                # assignment counts the number of list members (aka number
  +                # of matches) then
  +                my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg);
  +                my $cntclose = () = ($before =~ m|^\s*</.*$|mg);
  +
  +                if ($cntopen == $cntclose) {
  +                    # fine. Last LoadModule is contextless.
  +                    $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s;
  +                }
  +                elsif ($cntopen < $cntclose) {
  +                    error('Configuration file is not valid. There are sections'
  +                          . ' closed before opened.');
  +                    exit(1);
  +                }
  +                else {
  +                    # put our cmd after the section containing the last
  +                    # LoadModule.
  +                    my $found =
  +                    $content =~ s!\A (               # string and capture start
  +                                  (?:(?:
  +                                    ^\s*             # start of conf line with a
  +                                    (?:[^<]|<[^/])   # directive which does not
  +                                                     # start with '</'
  +
  +                                    .*(?:$)\n        # rest of the line.
  +                                                     # the '$' is in parentheses
  +                                                     # to avoid misinterpreting
  +                                                     # the string "$\" as
  +                                                     # perl variable.
  +
  +                                    )*               # catch as much as possible
  +                                                     # of such lines. (including
  +                                                     # zero)
  +
  +                                    ^\s*</.*(?:$)\n? # after the above, we
  +                                                     # expect a config line with
  +                                                     # a closing container (</)
  +
  +                                  ) {$cntopen}       # the whole pattern (bunch
  +                                                     # of lines that end up with
  +                                                     # a closing directive) must
  +                                                     # be repeated $cntopen
  +                                                     # times. That's it.
  +                                                     # Simple, eh? ;-)
  +
  +                                  )                  # capture end
  +                                 !$1$c$lmd\n!mx;
  +
  +                    unless ($found) {
  +                        error('Configuration file is not valid. There are '
  +                              . 'sections opened and not closed.');
  +                        exit(1);
  +                    }
  +                }
               } else {
  -                 $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg;
  +                # replace already existing LoadModule line
  +                $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|s;
               }
               $lmd =~ m|LoadModule\s+(.+?)_module.*|;
               notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]");
  
  
  

Mime
View raw message