Package: lighttpd
Version: 1.4.10-4
Severity: normal
Tags: patch

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

The Perl script lighty-enable-mod does not handle command line
arguments at all because of two programming errors (checks ARGV[1]
instead of ARGV[0], so only works when there are 2 or more arguments
and uses split on @ARGV which gives the length of the array).

See the attached patch for a fix of those errors and some small
enhancements and a fix for a grammatical error in one message.

- -- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.14-2-k7
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages lighttpd depends on:
ii  libbz2-1.0                    1.0.3-2    high-quality block-sorting file co
ii  libc6                         2.3.6-3    GNU C Library: Shared libraries an
ii  libldap2                      2.1.30-13  OpenLDAP libraries
ii  libpcre3                      6.4-1.1    Perl 5 Compatible Regular Expressi
ii  libssl0.9.8                   0.9.8a-7   SSL shared libraries
ii  lsb-base                      3.0-15     Linux Standard Base 3.0 init scrip
ii  mime-support                  3.36-1     MIME files 'mime.types' & 'mailcap
ii  zlib1g                        1:1.2.3-10 compression library - runtime

Versions of packages lighttpd recommends:
pn  php4-cgi                      <none>     (no description available)
pn  php5-cgi                      <none>     (no description available)

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEDeOCGf7YPOK+o0ERAjgVAJ9nNb6tc0D478uQqWKIEhJEeePrcQCgxmGa
a6eDlzVzhODYLCQFneqyHEc=
=T/c+
-----END PGP SIGNATURE-----
--- /usr/sbin/lighty-enable-mod 2006-02-13 13:23:22.000000000 +0100
+++ /home/tobias/bin/lighty-enable-mod  2006-03-07 20:37:23.494608494 +0100
@@ -36,11 +36,11 @@
 #--- list of avaiable modules
 my @files = bsd_glob($confdir.'conf-available/*.conf');
 print "Available modules: ";
-foreach my $file (@files) {            
-       if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) {              
+foreach my $file (@files) {
+       if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) {
                $available{$1} = $file;
                print qq{$1 };
-       }                       
+       }
 }
 print "\n";
 
@@ -48,14 +48,14 @@
 @files = bsd_glob($confdir.'conf-enabled/*.conf');
 print "Already enabled modules: ";
 foreach my $file (@files) {
-       if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) {              
+       if (basename($file) =~ /^\d+\-([\w\-]+)\.conf$/) {
                $enabled{$1} = $file;
-               print qq{$1 };          
+               print qq{$1 };
        }
 }
 print "\n";
 
-unless (defined($ARGV[1])) {
+unless (defined($ARGV[0])) {
        my $prompt =  $enabling ? 'Enable module: ' : 'Disable module: ';
        my $term = new Term::ReadLine $prompt;
        my $OUT = $term->OUT || \*STDOUT;
@@ -63,7 +63,7 @@
        @todo = split(/ /, $var);
 }
 else {
-       @todo = split(/ /, @ARGV);
+       @todo = @ARGV;
 }
 
 
@@ -76,19 +76,23 @@
                
                my $st = stat($target);
                unless ( -f $target ) {
-                       symlink($available{$do}, $target);
-                       print "ok\n";
-               } 
+                       if (symlink($available{$do}, $target)) {
+                               print "ok\n";
+                       }
+                       else {
+                               print "failure: $!\n";
+                       }
+               }
                else {
                        print "already enabled\n";
                }
 
                #--- check dependencies
-               for my $module ($moduledeps{$do})
+               for my $module (@{$moduledeps{$do}})
                {
                        unless ( -f $target && -l $target )
                        {
-                               print qq{Module $do depends from module $module 
which is not activated.\n};
+                               print qq{Module $do depends on module $module 
which is not activated.\n};
                        }
                }
        }

Reply via email to