Package: apache2.2-common Version: 2.2.21-5 Severity: minor Tags: patch
Hello, the bash_completion file for apache2 uses the same function for the 4 commands a2ensite, a2dissite, a2enmod, a2dismod. The function strips away any .load or .conf suffix from the file name taken from the output of ls in the appropriate directory. Although this is correct for the modules directories (a2{en,dis}mod expects a module name), it breaks the completion for a2{en,dis}site for any file in sites-{enabled,available} ending with .conf or .load, as the a2{en,dis}site script expect the name of an existing file: # ls /etc/apache2/sites-available 010_foo.example.com.conf default default-ssl # a2ensite <tab> 010_foo.example.com default default-ssl # a2ensite 010_foo_example.com ERROR: Site 010_foo_example.com does not exist! While it should be: # a2ensite 010_foo_example.com.conf Enabling site 010_foo_example.com.conf. Run '/etc/init.d/apache2 reload' to activate new configuration! # While it could be considered (?) atypical/wrong/anything to use .conf file names in /etc/apache2/sites-*, it's nevertheless wrong to strip away these suffixes from them. I've attached a small patch which splits the generation of COMPREPLY, stripping the suffixes only for a2{en,dis}mod. -- Package-specific info: List of enabled modules from 'apache2 -M': alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env mime negotiation php5 proxy_http proxy reqtimeout setenvif status userdir List of enabled php5 extensions: pdo suhosin -- System Information: Debian Release: wheezy/sid APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'testing'), (90, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 3.1.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages apache2.2-common depends on: ii apache2-utils 2.2.21-2 ii apache2.2-bin 2.2.21-5 ii lsb-base 3.2-28 ii mime-support 3.51-1 ii perl 5.14.2-5 ii procps 1:3.2.8-11 Versions of packages apache2.2-common recommends: ii ssl-cert 1.0.28 Versions of packages apache2.2-common suggests: ii apache2-doc <none> ii apache2-suexec | apache2-suexec-custom <none> ii google-chrome-unstable [www-browser] 17.0.963.0-r113143 ii iceweasel [www-browser] 8.0-3+b1 ii links [www-browser] 2.5-1 ii lynx-cur [www-browser] 2.8.8dev.9-3 ii w3m [www-browser] 0.5.3-4 Versions of packages apache2.2-common is related to: pn apache2-mpm-event <none> pn apache2-mpm-itk <none> pn apache2-mpm-prefork 2.2.21-5 pn apache2-mpm-worker <none> -- Configuration Files: /etc/apache2/sites-available/default changed [not included] -- debconf-show failed
Index: etc/bash_completion.d/apache2.2-common =================================================================== --- etc.orig/bash_completion.d/apache2.2-common 2012-01-26 16:15:08.000000000 +0100 +++ etc/bash_completion.d/apache2.2-common 2012-01-26 16:19:46.000000000 +0100 @@ -1,12 +1,22 @@ # bash completion for Debian apache2 configuration tools # $Id: apache2,v 1.1 2005/03/16 22:51:19 guillaume Exp $ -_apache2_modsites() +_apache2_allcomp() { - COMPREPLY=( $( compgen -W '$( command ls /etc/apache2/$1 2>/dev/null \ + command ls /etc/apache2/$1 2>/dev/null +} + +_apache2_mods() +{ + COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 \ | sed -e 's/[.]load$//' -e 's/[.]conf$//' )' -- $cur ) ) } +_apache2_sites() +{ + COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 )' -- $cur ) ) +} + _a2enmod() { local cur @@ -14,7 +24,7 @@ COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} - _apache2_modsites mods-available + _apache2_mods mods-available } complete -F _a2enmod a2enmod @@ -25,7 +35,7 @@ COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} - _apache2_modsites sites-available + _apache2_sites sites-available } complete -F _a2ensite a2ensite @@ -37,7 +47,7 @@ COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} - _apache2_modsites mods-enabled + _apache2_mods mods-enabled } complete -F _a2dismod a2dismod @@ -48,7 +58,7 @@ COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} - _apache2_modsites sites-enabled + _apache2_sites sites-enabled } complete -F _a2dissite a2dissite