Bug 63079 - Add a debug line if Directory instruction provides an invalid path
Summary: Add a debug line if Directory instruction provides an invalid path
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2019-01-16 18:04 UTC by stephane.blondon
Modified: 2020-04-11 18:49 UTC (History)
3 users (show)



Attachments
print a warning if Directory directive is incorrect (965 bytes, patch)
2020-01-10 09:01 UTC, stephane.blondon
Details | Diff
print a warning if Directory directive is incorrect (717 bytes, patch)
2020-02-17 16:14 UTC, stephane.blondon
Details | Diff
print a warning if Directory directive is incorrect (727 bytes, patch)
2020-02-20 12:15 UTC, stephane.blondon
Details | Diff
Updated patch with tag added (727 bytes, patch)
2020-03-04 17:58 UTC, Giovanni Bechis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description stephane.blondon 2019-01-16 18:04:44 UTC
`apachectl -t` should provide an info at 'debug' level if the path for
<Directory> directive does not exist.

For example, given <Directory /var/www/demo>,
if /var/www/demo does not exist, `apachectl -t -e DEBUG` does not complain (tested with v.2.4.37). It would display something like AH00112 for DocumentRoot:
'Warning: DocumentRoot [/var/www/demo] does not exist'
so it would be:
'Debug: Directory /var/www/demo does not exist'
Comment 1 mordax 2019-01-17 19:13:07 UTC
I'd like to work on this - however I am new to the project. Would you folks recommend this bug as something that a newcomer can tackle?
Comment 2 Christophe JAILLET 2019-01-17 21:29:38 UTC
Hi mordax,

yes this looks like a good candidate to start with.
  - Should be easy enough to get fast and visible results
  - Low risk, just a debug message added
  - Helpful to spot potential configuration issues (typo, ...)
In other work, perfect for a first try.

You should work on the 'trunk' branch as any patch has to go there first.

Do not hesitate to discuss on dev@httpd.apache.org for whatever help or explanation you need.

If not already done, first download code via svn, configure your build environment, build from source. Once you can get your own build server, you can start to change/fix/improve things.
Some docs are available for all that, but the new eye of a newcomer is always welcomed to improve our documentation.
So whatever looks missing, unclear, spurious, not working, please report it. It will be appreciated.


Welcome on board and happy hacking :)
Comment 3 Christophe JAILLET 2019-01-17 21:32:33 UTC
mordax: My comment #1 has not been mailed to you., so I've added you on the CC list of this bug so that you can receive any update.
Comment 4 mordax 2019-01-19 02:03:07 UTC
(In reply to Christophe JAILLET from comment #2)

Hi Christophe,

> Welcome on board and happy hacking :)

Thanks for the warm welcome, I'm looking forward to helping out! 

I appreciate the clarification on the steps - I've been reading the docs but it's always nice to have confirmation that you've understood correctly. And thanks, I'll reach out for help if I need it. 

Out of curiousity, would you recommend the Apache IRC channel for quick questions, or is it less active than the mailing list?

> Some docs are available for all that, but the new eye of a newcomer is
> always welcomed to improve our documentation.

Of course, speaking as a sad Windows developer, I'm no stranger to documentation improvements. ;) Happy to help out.
Comment 5 Christophe JAILLET 2019-01-19 06:52:19 UTC
(In reply to mordax from comment #4)
> Out of curiousity, would you recommend the Apache IRC channel for quick
> questions, or is it less active than the mailing list?

IRC is obviously more reactive, ... but it depends of who is online.
Mailing list is slower, ... but the audience is wider.

Personally, I nearly never use IRC. Some others are always connected (even if not always behind their keyboard :) ). Try out and make your own opinion.

I propose to you to switch to one (or both) of these 2 channels, in order not to hijack too much this report.
Comment 6 stephane.blondon 2019-01-19 14:07:27 UTC
I started to work on a patch after sending the bug report.

Currently, I guess the patch should include a call to ap_log_error(APLOG_MARK, APLOG_DEB, ...) around line 2374 in core.c.  (I used last archive of released apache to get a try).


However, I don't plan to contribute more to Apache in the future. So if mordax wants that, I think it's better if he does the patch.
Comment 7 stephane.blondon 2019-01-19 14:15:59 UTC
I started to work on a patch after sending the bug report.

Currently, I guess the patch should include a call to ap_log_error(APLOG_MARK, APLOG_DEB, ...) around line 2374 in core.c.  (I used last archive of released apache to get a try).


However, I don't plan to contribute more to Apache in the future. So if mordax wants that, I think it's better if he does the patch.

Currently, I stopped to work on it to avoid duplicate efforts.
Comment 8 mordax 2019-02-01 21:01:33 UTC
Still gonna work on this bug, however my attempts at getting the server built using a x64 Windows machine alongside VS studio 2017 tooling has failed relatively miserably. I had a process for writing out potentially new documentation for it, but I'm most likely going to abandon in it favour of a Linux vm and just building it there.

Unless there's a master who has it built and running perfectly from source on their Win machine in Apache?
Comment 9 stephane.blondon 2019-11-19 15:40:47 UTC
Mordax, are you still working on this improvement?
If not, I plan to spend some time on it.
Comment 10 stephane.blondon 2020-01-10 09:01:43 UTC
Created attachment 36960 [details]
print a warning if Directory directive is incorrect

This is a patch to provide a Warning is the Directory value is not valid.

For example:

$ apachectl -t -f ~/src/httpd-trunk/demo/site.conf
AH10229: Warning: <Directory "/x/y/z/"> does not exist or is not a directory
AH10229: Warning: <Directory "/etc/hostname"> does not exist or is not a directory

with '~/src/httpd-trunk/demo/site.conf' file contains:
<VirtualHost 127.0.0.1:80>
    ServerAdmin admin@yaal.fr
    ServerName demo

    <Directory /x/y/z/>
    </Directory>

    <Directory /etc/hostname>
    </Directory>
</VirtualHost>

What do you think about it?
Does it need some improvement to be merged?

The patch is attached to this message.
Comment 11 stephane.blondon 2020-02-17 16:14:21 UTC
Created attachment 37020 [details]
print a warning if Directory directive is incorrect

The new patch improves some details. Thanks to Christope about them!

I don't see the warning message anymore but, currently, it's the same behavior with the previous patch so I guess the problem comes from the build, not with the patch:


$ /home/stephane/bin/apache_trunk/bin/apachectl -t -f ~/src/httpd-trunk/demo/site.conf
AH: 
AH: 
Syntax OK

I plan to investigate on it.
Comment 12 Christophe JAILLET 2020-02-17 19:59:42 UTC
Hi Stéphane,

You added an extra comma after the APLOGNO().
Comment 13 stephane.blondon 2020-02-20 12:15:57 UTC
Created attachment 37028 [details]
print a warning if Directory directive is incorrect

Thanks Christophe!

This new patch fixes:
- the message is properly displayed
- there are no error if the path is correct
Comment 14 Giovanni Bechis 2020-03-04 17:58:35 UTC
Created attachment 37062 [details]
Updated patch with tag added

According to docs/log-message-tags/README the update-log-msg-tags perl script should be run to find the next free tag.

Diff updated with next free tag.
Comment 15 Eric Covener 2020-04-11 18:49:19 UTC
Thanks for the patch. Committed in 1876402 but I restricted it to run during an explicit configtest. I didn't want it appearing newly for people doing a routine stop/start -- maybe further discussion on dev@.