Bug 133704 - www/apache22 apxs does not work as expected
Summary: www/apache22 apxs does not work as expected
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-apache (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-13 13:30 UTC by Olli Hauer
Modified: 2010-05-08 13:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olli Hauer 2009-04-13 13:30:00 UTC
There is a miss behavior in the apxs script from apache22 (other versions not tested)

If you install a apache22 the LoadModule lines look like the following

 LoadModule *whitespace* ${modulename}_module *whitespace* libexec/apache22/mod_${modulename}.so

If you try now to activate/deactivate a module with apxs the result will differ from what you expect

How-To-Repeat: 
For the following test I will pick a long and two short module name (ssl autoindex cgi)

$> grep -e autoindex_ -e cgi_ httpd.conf
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule cgi_module libexec/apache22/mod_cgi.so


fire up the following commands

$> apxs -e -a -n autoindex mod_autoindex.so
[activating module `autoindex' in /usr/local/etc/apache22/httpd.conf]
$> apxs -e -a -n cgi mod_cgi.so
[activating module `cgi' in /usr/local/etc/apache22/httpd.conf]

This will result into the following httpd.conf

$> grep -e autoindex_ -e cgi_ httpd.conf
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule cgi_module libexec/apache22/mod_cgi.so
LoadModule autoindex_module   libexec/apache22/mod_autoindex.so
LoadModule cgi_module         libexec/apache22/mod_cgi.so


As you notice the modules are now loaded twice

Now try to deactivate for the loaded ssl module

$> grep ssl_ httpd.conf
LoadModule ssl_module libexec/apache22/mod_ssl.so

$> apxs -e -A -n ssl mod_ssl.so
[preparing module `ssl' in /usr/local/etc/apache22/httpd.conf]

$> grep ssl_ httpd.conf
LoadModule ssl_module libexec/apache22/mod_ssl.so
#LoadModule ssl_module         libexec/apache22/mod_ssl.so

Instead to deactivate the module a new line will be insert
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-04-13 18:38:53 UTC
Responsible Changed
From-To: freebsd-ports-bugs->apache

Fix synopsis and assign.
Comment 2 Philip M. Gollucci freebsd_committer freebsd_triage 2009-05-16 04:30:19 UTC
Responsible Changed
From-To: apache->pgollucci

started this one
Comment 3 Philip M. Gollucci 2009-05-19 06:12:49 UTC
I take that, its a bug in apache22 and apache20 apparently.

I'll fix this upstream and then pull the svn rev back in as a patch.

/me is dumb founded that this can be possible.
Comment 4 Philip M. Gollucci freebsd_committer freebsd_triage 2010-04-29 19:39:06 UTC
Responsible Changed
From-To: pgollucci->apache

Over to maintainer.
Comment 5 Philip M. Gollucci freebsd_committer freebsd_triage 2010-05-07 21:46:39 UTC
State Changed
From-To: open->analyzed

fix in upstream svn 

trunk: 2.3.x/2.4.x: http://svn.apache.org/viewvc?rev=942209&view=rev
2.2.x:              http://svn.apache.org/viewvc?rev=942210&view=rev
2.0.x:		    http://svn.apache.org/viewvc?rev=942211&view=rev

no future 1.3.x releases, no futher backports

This bug is almost as old has apxs and Apache httpd itself.
Comment 6 dfilter service freebsd_committer freebsd_triage 2010-05-07 21:54:03 UTC
pgollucci    2010-05-07 20:53:45 UTC

  FreeBSD ports repository

  Modified files:
    www/apache22         Makefile 
    www/apache22/files   patch-support__apxs.in 
  Log:
  - Fix -A and -a options for apxs to correctly ignore whitespace.
    This will fix about 100 pkg-plist left overs for httpd.conf
  - Bump PORTREVISION
  -  This will be in 2.2.16.
  
  PR:             ports/133704
  Obtained from:  http://svn.apache.org/viewvc?rev=942210&view=rev
  Reported by:    olli hauer <ohauer@gmx.de> (and very good pr!)
  With Hat:       apache@
  
  Revision  Changes    Path
  1.265     +1 -1      ports/www/apache22/Makefile
  1.2       +22 -1     ports/www/apache22/files/patch-support__apxs.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 dfilter service freebsd_committer freebsd_triage 2010-05-07 22:46:33 UTC
pgollucci    2010-05-07 21:46:21 UTC

  FreeBSD ports repository

  Modified files:
    www/apache22         Makefile pkg-plist 
    www/apache22/files   patch-support__apxs.in 
  Log:
  - Continuation of ports/133704
    apxs -A comments out the LoadModule line
    This adds custom FreeBSD mod to 'DELETE' the line so that it works with
    our pkg-plists in packages.
  - Remove -s form the cmp httpd.conf in pkg-plist to be blatant about why
    it didn't get removed
  - Tested with lang/php5
  - Bump PORTREVISION
  
  PR:             ports/133704
  With Hat:       apache@
  
  Revision  Changes    Path
  1.266     +1 -1      ports/www/apache22/Makefile
  1.3       +9 -3      ports/www/apache22/files/patch-support__apxs.in
  1.97      +2 -2      ports/www/apache22/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 8 Philip M. Gollucci freebsd_committer freebsd_triage 2010-05-07 22:49:05 UTC
State Changed
From-To: analyzed->closed

done and done!
Comment 9 dfilter service freebsd_committer freebsd_triage 2010-05-07 22:49:06 UTC
pgollucci    2010-05-07 21:48:58 UTC

  FreeBSD ports repository

  Modified files:
    www/apache20         Makefile pkg-plist 
    www/apache20/files   patch-support__apxs.in 
  Log:
  - Fix -A and -a options for apxs to correctly ignore whitespace.
    This will fix about 100 pkg-plist left overs for httpd.conf
    apxs -A comments out the LoadModule line
    This adds custom FreeBSD mod to 'DELETE' the line so that it works with
    our pkg-plists in packages.
  - Remove -s form the cmp httpd.conf in pkg-plist to be blatant about why
    it didn't get removed
  - Bump PORTREVISION
  - This will be in 2.0.64
  
  PR:             ports/133704
  Obtained from:  http://svn.apache.org/viewvc?rev=942211&view=rev
  Reported by:    olli hauer <ohauer@gmx.de> (and very good pr!)
  With Hat:       apache@
  
  Revision  Changes    Path
  1.276     +1 -1      ports/www/apache20/Makefile
  1.2       +22 -1     ports/www/apache20/files/patch-support__apxs.in
  1.88      +2 -2      ports/www/apache20/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 10 Olli Hauer 2010-05-08 13:17:33 UTC
pgollucci@FreeBSD.org wrote:
> Synopsis: www/apache22 apxs does not work as expected
> 
> State-Changed-From-To: analyzed->closed
> State-Changed-By: pgollucci
> State-Changed-When: Fri May 7 21:49:05 UTC 2010
> State-Changed-Why: 
> done and done!
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=133704
> 

Hi,

thanks for fixing this bug;)

Btw. since you are a member off apache.org, maybe you want to close
the following bugzilla issue.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47397

One note:
The FreeBSD hack removes the line complete so it is possible
to breaks apache if someone use apxs to control modules not
installed by a port since it removes the line completely.


What do you think about this hack (add an addition parameter [-r] to remove the 
line)

--- patch_apxs.txt begins here ---
--- /usr/local/sbin/apxs        2010-05-08 11:38:09.000000000 +0200
+++ apxs        2010-05-08 13:55:32.000000000 +0200
@@ -72,6 +72,7 @@
  my $opt_i = 0;
  my $opt_a = 0;
  my $opt_A = 0;
+my $opt_r = 0;
  my $opt_q = 0;
  my $opt_h = 0;
  my $opt_p = 0;
@@ -148,12 +149,14 @@
      print STDERR "               [-Wl,<flags>] [-p] <files> ...\n";
      print STDERR "       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] 
<dsofile> ...\n";
      print STDERR "       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] 
<dsofile> ...\n";
+    # FreeBSD hack, remove the line instead commenting out
+    print STDERR "       apxs -e [-r] [-A] [-n <modname>] <dsofile> ...\n";
      exit(1);
  }

  #   option handling
  my $rc;
-($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
+($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApr", @ARGV);
  &usage if ($rc == 0);
  &usage if ($#ARGV == -1 and not $opt_g);
  &usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not 
$opt_c and not $opt_e);
@@ -614,7 +617,7 @@
              } else {
                  # replace already existing LoadModule line
                  # Custom FreeBSD mod
-                if ($opt_A) {
+                if ($opt_A and $opt_r) {
                      $content =~ s|^(.*\n)#?\s*$lmd_re[^\n]*\n|$1|s;
                  }
                  else {
--- patch_apxs.txt ends here ---