apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r584626 - /apr/apr/branches/1.2.x/test/testnames.c
Date Sun, 14 Oct 2007 22:17:01 GMT
Author: wrowe
Date: Sun Oct 14 15:17:01 2007
New Revision: 584626

URL: http://svn.apache.org/viewvc?rev=584626&view=rev
Log:
We are reasonably confident this behaves as expected,
and while we will continue to emit noise when the
strings mismatch, apr_filepath_get didn't promise any
canonicalized correct path.

mingw/cygwin users requested the drive case check already
since those can show up as lowercase (and we canonicalize
these 26 values to uppercase for consistency), I just
observed the same on Windows 2003 Server SP2.

But worse, the string compare is bogus, since one can
set their path to c:\Apache~.6 when canonically the path
is c:\Apache2.2.6, and we didn't promise otherwise.  We'll
gently ignore this exception on OS2/Netware/Win32 where
I presume the same can happen.

Backport: 584625

Modified:
    apr/apr/branches/1.2.x/test/testnames.c

Modified: apr/apr/branches/1.2.x/test/testnames.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/test/testnames.c?rev=584626&r1=584625&r2=584626&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testnames.c (original)
+++ apr/apr/branches/1.2.x/test/testnames.c Sun Oct 14 15:17:01 2007
@@ -228,13 +228,18 @@
     const char *path = "//";
     char *origpath;
     char *testpath;
+    int hadfailed;
 
     ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p));
     path = origpath;
     rv = apr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p);
 
 #if defined(WIN32) || defined(OS2)
-    ABTS_INT_EQUAL(tc, origpath[0], root[0]);
+    hadfailed = tc->failed;
+    /* It appears some mingw/cygwin and more modern builds can return
+     * a lowercase drive designation, but we canonicalize to uppercase
+     */
+    ABTS_INT_EQUAL(tc, toupper(origpath[0]), root[0]);
     ABTS_INT_EQUAL(tc, ':', root[1]);
     ABTS_INT_EQUAL(tc, '/', root[2]);
     ABTS_INT_EQUAL(tc, 0, root[3]);
@@ -262,7 +267,16 @@
                           | APR_FILEPATH_NOTABOVEROOT
                           | APR_FILEPATH_NOTRELATIVE, p);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+    hadfailed = tc->failed;
+    /* The API doesn't promise equality!!! 
+     * apr_filepath_get never promised a canonical filepath.
+     * We'll emit noise under verbose so the user is aware,
+     * but translate this back to success.
+     */
     ABTS_STR_EQUAL(tc, origpath, testpath);
+#if defined(WIN32) || defined(OS2) || defined(NETWARE)
+    if (!hadfailed) tc->failed = 0;
+#endif
 }
 
 



Mime
View raw message