From owner-freebsd-ports@FreeBSD.ORG Fri Jan 4 08:12:47 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 49B131FD for ; Fri, 4 Jan 2013 08:12:47 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from mail-ie0-f169.google.com (mail-ie0-f169.google.com [209.85.223.169]) by mx1.freebsd.org (Postfix) with ESMTP id 22223338 for ; Fri, 4 Jan 2013 08:12:46 +0000 (UTC) Received: by mail-ie0-f169.google.com with SMTP id c14so19386011ieb.14 for ; Fri, 04 Jan 2013 00:12:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FSWtoY8qgeQND/zFqDcM3W1JJKdAdSN89JywQCA6+gs=; b=sfGZsF/4c3AstOXrG2UaXbTCZqxsJmiCy1Vgp6rxVJxNWmVDtZe9ZkXhCM4uY0H8SS n3Qvmw+0eUexw0lza5PHhJTYTg2uPGHvuytpxh0eBYHZmpFUHvuRurhq3dtlDKD4s7yy NeGwz75VXd34t/45tnyGmBFa02bGVg5rLgIcMl4iXsy+DeSz5ZtO095aEKz3z3Yn2xf3 w+FlRd/YIj0LVIbZe7i69IWQ+0WHTb4fSwCq65S4WOXI7pPkPEDred3x4baTQGSKC2xa jug0mpOGUMctz+AitRfUEm+PBHCE6/eVfKlAM3DgncG5nW/7IYpyQOapN3I9QJ3s60Rr WtgA== MIME-Version: 1.0 Received: by 10.50.53.175 with SMTP id c15mr40254754igp.106.1357287166277; Fri, 04 Jan 2013 00:12:46 -0800 (PST) Received: by 10.50.49.3 with HTTP; Fri, 4 Jan 2013 00:12:46 -0800 (PST) In-Reply-To: <50E5FCDA.80906@quip.cz> References: <50E49A73.2070008@quip.cz> <50E5FCDA.80906@quip.cz> Date: Fri, 4 Jan 2013 02:12:46 -0600 Message-ID: Subject: Re: What is policy about auto-editing config files on port install / deinstall? From: Scot Hetzel To: Miroslav Lachman <000.fbsd@quip.cz> Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2013 08:12:47 -0000 On Thu, Jan 3, 2013 at 3:49 PM, Miroslav Lachman <000.fbsd@quip.cz> wrote: >> What errors are you getting when re-installing an Apache module? > > > Apache modules are not enabled by default. I am talking about 3rd party > modules. In some cases, they do nothing with httpd.conf, in other cases, > they are adding commented line and I must manualy uncomment this line, so it > is my will to have this module loaded / enabled. > > But upgrade or reinstall or deinstall of this module causes commenting this > line out. It is undesirable. > If I enable this module and this module will be updated 10 times a year, why > am I forced to re-enable it 10 times again? > > Real world example follows: > > root@spare ~/# uname -srmi > FreeBSD 8.3-RC2 amd64 GENERIC > > ___________________________________________________ > Only Apache is installed, no 3rd party modules > > root@spare ~/# pkg_info -E ap22\* apache22-\* > apache22-2.2.23_4 > > ___________________________________________________ > Copy the config file for later comparision > > root@spare ~/# cp -P /usr/local/etc/apache22/httpd.conf httpd.conf.orig > > ___________________________________________________ > Install mod_xsendfile > > root@spare ~/# portmaster www/mod_xsendfile > > ===>>> Installation of www/mod_xsendfile (ap22-mod_xsendfile-0.12_2) > complete > > ___________________________________________________ > There is commented LoadModule line after install added to httpd.conf > > root@spare ~/# diff -U 2 httpd.conf.orig /usr/local/etc/apache22/httpd.conf > --- httpd.conf.orig 2013-01-03 12:56:22.000000000 +0100 > +++ /usr/local/etc/apache22/httpd.conf 2013-01-03 21:25:03.000000000 +0100 > @@ -75,4 +75,5 @@ > LoadModule rewrite_module libexec/apache22/mod_rewrite.so > LoadModule php5_module libexec/apache22/libphp5.so > +#LoadModule xsendfile_module libexec/apache22/mod_xsendfile.so > > ___________________________________________________ > I must manually uncomment the line (which is OK, I don't need to modules be > auto enabled as services are not enabled in rc.conf) > > root@spare ~/# vi /usr/local/etc/apache22/httpd.conf > > LoadModule xsendfile_module libexec/apache22/mod_xsendfile.so > > ___________________________________________________ > Then I added some configuration to VirtualHost > > root@spare ~/# vi > /usr/local/etc/apache22/vhosts/available/www.example.com.conf > > XSendFile on > XSendFilePath /vol0/web/test > > ___________________________________________________ > Diff shows that module is enabled > > root@spare ~/# diff -U 2 httpd.conf.orig /usr/local/etc/apache22/httpd.conf > --- httpd.conf.orig 2013-01-03 12:56:22.000000000 +0100 > +++ /usr/local/etc/apache22/httpd.conf 2013-01-03 21:26:46.000000000 +0100 > @@ -75,4 +75,5 @@ > LoadModule rewrite_module libexec/apache22/mod_rewrite.so > LoadModule php5_module libexec/apache22/libphp5.so > +LoadModule xsendfile_module libexec/apache22/mod_xsendfile.so > > ___________________________________________________ > Syntax check > > root@spare ~/# httpd -t > Syntax OK > > ___________________________________________________ > Reinstallation of the module (same as upgrading) > > root@spare ~/# portmaster ap22-mod_xsendfile-0.12_2 > > ===>>> Creating a backup package for old version ap22-mod_xsendfile-0.12_2 > ===>>> Package saved to /usr/ports/packages/portmaster-backup > > Don't forget to remove all mod_xsendfile-related directives in your > httpd.conf > > ===> Installing for ap22-mod_xsendfile-0.12_2 > ===> Generating temporary packing list > ===> Checking if www/mod_xsendfile already installed > /usr/local/share/apache22/build/instdso.sh > SH_LIBTOOL='/usr/local/share/apr/build-1/libtool' > /usr/ports/www/mod_xsendfile/work/mod_xsendfile-0.12/mod_xsendfile.la > /usr/local/libexec/apache22 > /usr/local/share/apr/build-1/libtool --mode=install cp > /usr/ports/www/mod_xsendfile/work/mod_xsendfile-0.12/mod_xsendfile.la > /usr/local/libexec/apache22/ > libtool: install: cp > /usr/ports/www/mod_xsendfile/work/mod_xsendfile-0.12/.libs/mod_xsendfile.so > /usr/local/libexec/apache22/mod_xsendfile.so > libtool: install: cp > /usr/ports/www/mod_xsendfile/work/mod_xsendfile-0.12/.libs/mod_xsendfile.lai > /usr/local/libexec/apache22/mod_xsendfile.la > libtool: install: cp > /usr/ports/www/mod_xsendfile/work/mod_xsendfile-0.12/.libs/mod_xsendfile.a > /usr/local/libexec/apache22/mod_xsendfile.a > libtool: install: chmod 644 /usr/local/libexec/apache22/mod_xsendfile.a > libtool: install: ranlib /usr/local/libexec/apache22/mod_xsendfile.a > chmod 755 /usr/local/libexec/apache22/mod_xsendfile.so > [preparing module `xsendfile' in /usr/local/etc/apache22/httpd.conf] > ===> Registering installation for ap22-mod_xsendfile-0.12_2 > > ===>>> Creating a package for new version ap22-mod_xsendfile-0.12_2 > ===>>> Package saved to /usr/ports/packages/All > > ===>>> Re-installation of ap22-mod_xsendfile-0.12_2 complete > > > ___________________________________________________ > And there is a problem - syntax error, because module was disabled > (commented out on deinstall) and some directives remained in VirtualHost > definition - Apache will not start! > > root@spare ~/# httpd -t > Syntax error on line 57 of > /usr/local/etc/apache22/vhosts/available/www.example.com.conf: > Invalid command 'XSendFile', perhaps misspelled or defined by a module not > included in the server configuration > > ___________________________________________________ > Diff shows commented out line > > root@spare ~/# diff -U 2 httpd.conf.orig /usr/local/etc/apache22/httpd.conf > --- httpd.conf.orig 2013-01-03 12:56:22.000000000 +0100 > +++ /usr/local/etc/apache22/httpd.conf 2013-01-03 21:32:26.000000000 +0100 > @@ -75,4 +75,5 @@ > LoadModule rewrite_module libexec/apache22/mod_rewrite.so > LoadModule php5_module libexec/apache22/libphp5.so > +#LoadModule xsendfile_module libexec/apache22/mod_xsendfile.so > > ___________________________________________________ > > I think this behavior is wrong. > > Why am I forced to manualy re-enable all 3rd party modules on each upgrade? > > Modules should not disable something that is explicitly enabled by user / > system administrator. > > I found the cause of your issue, the www/mod_sendfile/Makefile has AP_GENPLIST= yes defined. This causes the port to use this code to create the packing list: Mk/bsd.apache.mk 451 ap-gen-plist: 452 .if defined(AP_GENPLIST) 453 . if !exists(${PLIST}) 454 @${ECHO} "===> Generating apache plist" 455 # apache22 456 @${ECHO} "@unexec ${SED} -i '' -E '/LoadModule[[:blank:]]+%%AP_NAME%%_module/d' %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST} 457 @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST} 458 @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} 459 @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST} 460 . endif 461 .else 462 @${DO_NADA} 463 .endif 464 .endif As well as adding the module disabled in the httpd.conf file: 472 do-install: 473 @${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} This is what is causing your problem with the module being disabled after an upgrade of the port/package. Mk/bsd.apache.mk should be changed to: 451 ap-gen-plist: 452 .if defined(AP_GENPLIST) 453 . if !exists(${PLIST}) 454 @${ECHO} "===> Generating apache plist" 455 # apache22 D456 457 @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST} C458 @${ECHO} "@exec %D/sbin/apxs -e -a -n %%AP_NAME%% %D/%F" >> ${PLIST} @${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} 459 @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST} 460 . endif 461 .else 462 @${DO_NADA} 463 .endif 464 .endif 472 do-install: C473 @${APXS} -i -a -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} Then it will do the right thing when installing/uninstalling/re-installing the port. Give the above changes a try, it should do the right thing. If it works for you, send-pr a diff of the changes. For a port that installs/uninstalls it's module the correct way have a look at www/mod_xmlns. -- DISCLAIMER: No electrons were maimed while sending this message. Only slightly bruised.