[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] docstrings on apr_filepath_merge() flags?

From: William A. Rowe, Jr. <wrowe_at_rowe-clan.net>
Date: 2002-07-18 22:28:28 CEST

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 18 22:31:24 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.