[pkg-lighttpd] Bug#600050: /etc/lighttpd/conf-available/15-fastcgi-php.conf: fastcgi-php file missing a required directive

Arno Töll debian at toell.net
Tue Jan 4 18:43:07 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
once more, I provide a patch. This time it closes #600050. I modified
lighty-enabled-mod to take care of a magic line for modules placed in
the conf-available folder.

That is, if it contains a special dependency reference that indicates
modules that must be loaded as well, when activating the chosen module.
Those are then automagically loaded.

For example as referenced in the bug, fastcgi-php needs fastcgi loaded
as well. So one would configure the dependency in 15-fastcgi-php.conf as
follows:

<snip>
# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
#
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
...
<snip>

The dependency magic line has the following syntax (Perl regular
expression):

# -\*- depends: ([-\w, ]+) -\*-/

That is:
- - it starts with a comment (#)
- - it contains the line -*- depends: MODULE_LISTING -*-
where MODULE_LISTING is one or more module base names separated by a
comma (,) and one or more optional whitespace caracters.

Therefore valid dependency magic lines are:

# -*- depends: foo -*-
# -*- depends: foo, bar -*-
# -*- depends: foo,bar -*-
# -*- depends: foo,   bar,baz -*-

The attached patch contains a working example for fastcgi-php
configuration, that depends as pointed out on fastcgi like this:

# -*- depends: fastcgi -*-

I briefly checked other modules as well, but it rather seems to me that
none of them needs a dependency line. If needed, my patch works for
other necessary dependencies as well though, even if my diff doesn't
change anything else besides 15-fastcgi-php.

lighty-enable-mod (for reference: also lighty-disable-mod which is
nothing but a symlink) now behaves like this when a dependency is found:

root at test1:~# lighty-enable-mod fastcgi-php
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules:
Met dependency: fastcgi
Enabling fastcgi-php: ok
Enabling fastcgi: ok

This change is backward compatible, that means it does not fail if there
is no dependency line. Note that this also implies that the user won't
profit from this change unless they reinstall the package by installing
the new configuration files which do provide the new magic line.
Moreover the patch doesn't do anything if there is already an enabled
module from a previous installation.
For example, if one already has enabled fastcgi-php but not fastcgi
(which causes this bug), even after enabling it again lighty-enable-mod
won't do anything. This is by design (as it does not do anything if
symlinks do already exist, this is a feature, one of the previous
contributors introduced).


Note, that the reverse problem applies if one disables, say, fastcgi.
This renders fastcgi-php unusable. Thanks to the magic line,
lighty-enable-mod also takes care:

root at test1:~# lighty-disable-mod fastcgi-php
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules: fastcgi fastcgi-php
Disabling fastcgi-php
Run /etc/init.d/lighttpd force-reload to enable changes
root at test1:~#

Nothing happened here, as it is perfectly ok to disable fastcgi-php but
not fastcgi. So enable it again:

root at test1:~# lighty-enable-mod fastcgi-php
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules: fastcgi
Enabling fastcgi-php: ok
Run /etc/init.d/lighttpd force-reload to enable changes

Now let's disable fastcgi. This breaks a dependency for fastcgi-php:

root at test1:~# lighty-disable-mod fastcgi
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules: fastcgi fastcgi-php
Disabling fastcgi
Reverse dependency met: Disabling fastcgi-php too
Disabling fastcgi-php
Run /etc/init.d/lighttpd force-reload to enable changes
root at test1:~#


The attached patch changes debian/lighty-enable-mod and
debian/conf-available/15-fastcgi-php.conf. For the code changes there is
to note:

* The code already contained a module dependency stub. That was not
functional (because of an empty dependency list). I removed that code,
as I found it a bad design decision to hard link dependency lists
directly into the lighty-enable-mod code.
* I added depdendency checks for enable/disable as explained above
* This time I provide the patch only, not a full patch changing
debian/changelog as well.
* lighty-enable-mod will skip processing now (non fatal), if a given
module does not exist. The current version does not even indicate this,
but silently assume user's won't provide broken links. For example:

root at test1:~# lighty-disable-mod foo
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules:
Already disabled foo
Run /etc/init.d/lighttpd force-reload to enable changes

Now it indicates an error:

root at test1:~# lighty-disable-mod
Available modules: auth accesslog cgi fastcgi no-www proxy rrdtool
simple-vhost ssi ssl status userdir fastcgi-php debian-doc
Already enabled modules:
Disable module: foo
Ignoring unknown module: foo
Run /etc/init.d/lighttpd force-reload to enable changes


- -- 
with kind regards,
Arno Töll
GnuPG Key-ID: 0x8408D4C4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJNI2o6AAoJELBdpXvEXpo9Qd4P/RnXqozatvzTU6p7MZcVulZL
1Nkw98WzGz9IjyW2Zyafga1WW/nzpCda8d8AFVE68R542Ic3xSZrZQWVlIv7MEv3
Tmts5X6HfGEEwA1t1mMVu3WrEU+Dm0DshqFY7AYq3Z5kX6/UFJzJvGTGDybpA/6b
YlOAdnQQ1eHI73AfPlvImRKSsg+9AKf7ATT5DfQE/ACcfcW/hvAz9GcpIETofbaJ
vLMC1XpeZuycI1T3QJky1dLu3CQNnA8RBsUuxoAW11pbsKXKTJSM0rLVv3v4SJl8
wollhSmw1qc6qbuvKd5O9bT1xKc6wSJcJV67pJMPRoYqycHg5vawPqzbfzTkD+Ex
1yylwU1r5wq6QtzXTGwejyfP+kdgYlL6qFviXu4mGyR6a++/2C7/ZNrjcPXH2YTY
9KPCqJRQzZg8POkQ88yEZKeg5AaF80TWTHLtUzHvEb/M+eDA/yMDpY9oXGlTCSdf
8OdbcHtu+ht6i+yEBW/OKV0iD4r4HWFN3TS6LDypGhFN3brQjpCTjWN7kaFD+J7a
bu1EQP7H6cBexnzV1Fcv/prU9DhMHi01S14Bx0jmBCUM/dQY5UzvaXqSeSxNEqlt
/SN36BbfDm2kzF6O1L0rE4UDCXFw6EKl0fbUw5m/BUmBFs0TANbdza/u74LxZJtg
iQ3bRUKbLnypOdx+nM85
=2f1N
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lighttpd-600050.patch
Type: text/x-diff
Size: 3624 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-lighttpd-maintainers/attachments/20110104/770c9cea/attachment.patch>


More information about the pkg-lighttpd-maintainers mailing list