IncludeOptional fails when a directory does not exist

Bug #1766186 reported by Dmitrii Shcherbakov on 2018-04-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Undecided
Unassigned

Bug Description

[Impact]

An instruction in apache config such as the following will make apache2 fail to start if the target path does not exist:

IncludeOptional /etc/apache2/mellon/sp-location*.conf

https://paste.ubuntu.com/p/f2Tb9rgrBB/ (full file: /etc/apache2/sites-enabled/openstack_https_frontend.conf)

Apr 23 06:58:31 maas-xenial1 apache2[28269]: * The apache2 configtest failed.
Apr 23 06:58:31 maas-xenial1 apache2[28269]: Output of config test was:
Apr 23 06:58:31 maas-xenial1 apache2[28269]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 17 of /etc/apache2/sites-enabled/openstack_https_frontend.conf: Could not o
Apr 23 06:58:31 maas-xenial1 apache2[28269]: Action 'configtest' failed.
Apr 23 06:58:31 maas-xenial1 apache2[28269]: The Apache error log may have more information.
Apr 23 06:58:31 maas-xenial1 systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 23 06:58:31 maas-xenial1 systemd[1]: Failed to start LSB: Apache2 web server.

A fix is available upstream:

https://bz.apache.org/bugzilla/show_bug.cgi?id=57585
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878920

https://github.com/apache/httpd/commit/a17ce7dd5e6277867ca48659f70c4bb8a11add56#diff-18a4bdb1520687ad43a0b4dd2b51d957R1954

[Test Case]

 * add IncludeOptional /etc/apache2/mellon/sp-location*.conf to an apache config file and try to restart the apache2 service

[Regression Potential]

 * minimal, the patch eases up requirements without rewriting or removing the existing code;
 * the patch author says that it's been used for ~ 3 years in clearlinux https://bz.apache.org/bugzilla/show_bug.cgi?id=57585#c4
 * applied in debian https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=878920#22

description: updated
Dmitrii Shcherbakov (dmitriis) wrote :

Tried 2.4.33 from Debian sid with the fix included and a dummy path ("/etc/apache2/whatever" dir does not exist):

IncludeOptional /etc/apache2/whatever/*

stat /etc/apache2/whatever
stat: cannot stat '/etc/apache2/whatever': No such file or directory

apt policy apache2
apache2:
  Installed: 2.4.33-2
  Candidate: 2.4.33-2
  Version table:
 *** 2.4.33-2 500
        500 http://ftp.de.debian.org/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status

It works properly as opposed to the version without the fix which fails with:

Apr 25 22:19:27 maas-xenial1 apache2[18520]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 16 of /etc/apache2/sites-enabled/openstack_https_frontend.conf: Could not o

Dmitrii Shcherbakov (dmitriis) wrote :

At the same time including a wildcard at the end of the non-existent directory name with 2.4.18-2ubuntu3.8 makes apache2 happy:

IncludeOptional /etc/apache2/whatever*/*

apt policy apache2
apache2:
  Installed: 2.4.18-2ubuntu3.8
  Candidate: 2.4.18-2ubuntu3.8

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

Other bug subscribers