You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ben Reser <be...@reser.org> on 2014/07/09 02:08:18 UTC

APR_FNM_PERIOD and apr_fnmatch()

I've attached a small documentation fix patch that hopefully clears up the
ambiguity in the documentation of the APR_FNM_PERIOD flag to apr_fnmatch().

apr_fnmatch() is designed to allow applications to duplicate shell style
globbing in a platform independent way.  There are several flags to change the
behavior slightly in order to match what the application may want.

The APR_FNM_PATHNAME flag prevents wildcards from matching the '/' character,
which allows applications to prevent wildcards to avoid cross path segments.
This flag is documented as "Slash must be matched by slash."

The APR_FNM_PERIOD flag prevents a leading period (the very first character in
the string to apply the pattern against) from matching a wildcard.  The purpose
of this flag is to allow applications to avoid matching files that have names
with an initial period, which is commonly used as a way to hide files on *nix
platforms.  This flag is documented as "Period must be matched by period."

Unfortunately, this documentation of APR_FNM_PERIOD implies to a reader (that
doesn't look at the code or experiment with the code) that it prevents the
wildcard from matching any character in the string with a period.  Similar to
how APR_FNM_PATHNAME behaves, especially due to the shared phrasing of the
documentation.

I believe my attached patch resolves this ambiguity (or at least makes it clear
that APR_FNM_PATHNAME and APR_FNM_PERIOD do not share the same behavior just
for different characters) and would appreciate if it would be applied.

Re: APR_FNM_PERIOD and apr_fnmatch()

Posted by Branko Čibej <br...@apache.org>.
On 09.07.2014 02:08, Ben Reser wrote:
> I've attached a small documentation fix patch that hopefully clears up the
> ambiguity in the documentation of the APR_FNM_PERIOD flag to apr_fnmatch().

Thanks! Committed in r1608974.

-- Brane