I've got a path as a command-line argument, and I'm trying to convert
it to canonical case using apr_filepath_merge:
apr_err = apr_filepath_merge (&truenamed_target, NULL, raw_target,
APR_FILEPATH_TRUENAME, pool);
Unfortunately, this had the side-effect of converting a relative path
into an absolute path.
After some experimentation, I discovered that adding the
APR_FILEPATH_NOTABSOLUTE flag prevented this behavior.
What annoys me is that I *deliberately* ignored this flag, because of
its cryptic docstring:
/** Fail apr_filepath_merge if the merged path is absolute */
#define APR_FILEPATH_NOTABSOLUTE 0x08
I read this docstring, and thought it was talking about somehow
restricting the *inputs* to the function... like forcing the function
to only accept absolute paths, or something. It doesn't make a lot of
sense.
Does anyone mind if I apply this patch?
Index: apr_file_info.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_info.h,v
retrieving revision 1.32
diff -u -r1.32 apr_file_info.h
--- apr_file_info.h 20 Mar 2002 08:54:43 -0000 1.32
+++ apr_file_info.h 18 Jul 2002 19:46:59 -0000
@@ -299,10 +299,10 @@
*/
#define APR_FILEPATH_SECUREROOT 0x03
-/** Fail apr_filepath_merge if the merged path is relative */
+/** Return an absolute merged path */
#define APR_FILEPATH_NOTRELATIVE 0x04
-/** Fail apr_filepath_merge if the merged path is absolute */
+/** Return a relative merged path */
#define APR_FILEPATH_NOTABSOLUTE 0x08
/** Return the file system's native path format (e.g. path delimiters