Bug 52817 - Long directory path sucks (but it's really a valid path!!!)
Summary: Long directory path sucks (but it's really a valid path!!!)
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.1
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-03 23:44 UTC by Tianyin Xu
Modified: 2012-03-04 18:09 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tianyin Xu 2012-03-03 23:44:40 UTC
Hi, sorry, maybe it's a little bit weird. But I do have a very long directory path (but not that long to exceed the buffer length 16*1024*1024) to put in my configuration file, like 

ServerRoot /very/long/directory/path

Then, the apache tells: 
"httpd: Syntax error on line 33 of /home/tianyin/apache-2.4.1/conf/httpd.conf: ServerRoot must be a valid directory"

But I have to say that it is for sure a valid directory. I can use "cd" to go to that directory. 

When looking at the source code, the problem seems that it uses the "stat" to check the path state and simply check the return value (0 for success, 1 for failure). 

I think it's necessary to check the errno and tell users the exact problem instead of just saying "invalid" (I have to say this bugs me a while), for example: 

EACCES Search permission is denied for one of the directories in the path prefix of path.  (See also path_resolution(7).)

EBADF fd is bad.

EFAULT Bad address.

ELOOP  Too many symbolic links encountered while traversing the path.

ENAMETOOLONG File name too long.

ENOENT A component of path does not exist, or path is an empty string.

ENOMEM Out of memory (i.e., kernel memory).

ENOTDIR A component of the path prefix of path is not a directory.

EOVERFLOW (stat()) path refers to a file whose size cannot be represented in the type off_t.