a2ensite fails if the conf filename contains whitespace

Bug #1336833 reported by Chris Drost
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)

Bug Description

Package version tested: 2.4.7-1ubuntu4

Expected behavior: site names should be whitespace-tolerant.

[Side note: site names should probably also not require the .conf extension, as there should be no other normal files in sites-enabled/ -- just filtering out directories (for version control systems which wrongly version sites-enabled rather than sites-available) should suffice. This also eliminates the complicated logic where a2ensite looks both for "$1" and "$1.conf", unless we want to keep that for historical compatibility reasons. ]

Observed behavior: a2ensite breaks when there is whitespace in a site name.

Steps to reproduce:

$ sudo su -
# cd /etc/apache2/sites-available
# cp -a 000-default.conf '001 filename with whitespace.conf'
# a2ensite '001 filename with whitespace.conf'
ERROR: Site 001 does not exist!
ERROR: Site filename does not exist!
ERROR: Site with does not exist!
ERROR: Site whitespace does not exist!

description: updated
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

The a2ensite command derives from Debian, so any changes to its behaviour should probably be made there in the first instance.

Next steps: check if Debian is affected. If it is, then a bug should be filed against apache2 in Debian if one is not filed there already.

tags: added: needs-upstream-report
Changed in apache2 (Ubuntu):
importance: Undecided → Low
Revision history for this message
Teluka (mateusz-p) wrote :

I did test of apache2 (2.4.18-2ubuntu3.5) on Xenial.

I can enable configuration file with white spaces with following command.

# a2ensite "this\ is\ a\ test.conf"
Enabling site this is a test.
To activate the new configuration, you need to run:
  service apache2 reload

a2ensite supports only *.conf files for reasons of compatibility with main configuration.

# grep sites-enabled /etc/apache2/apache2.conf
# `-- sites-enabled
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
IncludeOptional sites-enabled/*.conf

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.