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

Re: log --search test failures on trunk and 1.8.x

From: Stefan Sperling <stsp_at_elego.de>
Date: Sun, 21 Apr 2013 14:05:03 +0200

On Sun, Apr 21, 2013 at 01:53:43PM +0200, Bert Huijben wrote:
> I'd rather pull the case insensitive search part of this new in 1.8 search feature and do it right in 1.9.

What's the issue with the current implementation apart from the
test failures on Windows?

The behaviour of 'svn log --search' regarding case-sensitivity
isn't even documented, so we're not really prosmising anything.

It is possible that some users who are using languages other than
English will complain, since ASCII is being matched case-insensitively,
and all other characters are being matched case-sensitively.
But this is due to a missing feature in APR's implemention of fnmatch().

Provided we can fix the 1.8.x tests on Windows I see no reason to
change our implementation of log --search. We can simply wait for
APR to grow the necessary support for multibyte strings.

Does the patch to APR below fix the 1.8.x tests on Windows?

Index: strings/apr_fnmatch.c
===================================================================
--- strings/apr_fnmatch.c (revision 1470158)
+++ strings/apr_fnmatch.c (working copy)
@@ -135,8 +135,10 @@ leadingclosebrace:
                 /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
                 if ((**string >= *startch) && (**string <= **pattern))
                     result = 0;
- else if (nocase && (isupper(**string) || isupper(*startch)
- || isupper(**pattern))
+ else if (nocase
+ && **string >= 0 && *startch >= 0 && **pattern >= 0
+ && (isupper(**string) || isupper(*startch)
+ || isupper(**pattern))
                             && (tolower(**string) >= tolower(*startch))
                             && (tolower(**string) <= tolower(**pattern)))
                     result = 0;
@@ -148,7 +150,8 @@ leadingclosebrace:
             /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
             if ((**string == **pattern))
                 result = 0;
- else if (nocase && (isupper(**string) || isupper(**pattern))
+ else if (nocase && **string >= 0 && **pattern >= 0
+ && (isupper(**string) || isupper(**pattern))
                             && (tolower(**string) == tolower(**pattern)))
                 result = 0;
 
@@ -175,7 +178,8 @@ leadingclosebrace:
     /* XXX: handle locale/MBCS comparison, advance by the MBCS char width */
     if (**string == **pattern)
         result = 0;
- else if (nocase && (isupper(**string) || isupper(**pattern))
+ else if (nocase && **string >= 0 && **pattern >= 0
+ && (isupper(**string) || isupper(**pattern))
                     && (tolower(**string) == tolower(**pattern)))
         result = 0;
 
Received on 2013-04-21 14:05:41 CEST

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