apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH] docstrings on apr_filepath_merge() flags?
Date Thu, 18 Jul 2002 20:28:28 GMT
At 02:47 PM 7/18/2002, Ben Collins-Sussman wrote:

>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.

Per the apr_filepath_merge docs [and if it's not there, it needs to be],
passing a rootpath of NULL == the cwd.  Passing a rootpath of ""
(empty) means merge raw_target to an empty path.

Please try passing "" to the root path (meaning, merge the path to
no characters) and see if that solves your problem.

Perhaps the solution is to disambiguate NULL from Empty("") and
use a flag instead to designate the "Use CWD" behavior instead
of using a NULL arg.

>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 wouldn't have expected that, either.  Ick.  I'll be happy to delve into
the code so we can grok this.

>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.

No it doesn't.

>Does anyone mind if I apply this patch?

Please don't.  The flags should do exactly what they said.  If we aren't
returning a full path, every time that the rootpath argument is either
NULL (cwd) or a specific full path, then the function is wrong, not the
docs.

I need to review the original intents before I toss out any more feedback.

Bill




Mime
View raw message