subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1137967 - in /subversion/trunk/subversion: libsvn_subr/dirent_uri.c tests/libsvn_subr/dirent_uri-test.c
Date Tue, 21 Jun 2011 11:51:27 GMT
Author: julianfoad
Date: Tue Jun 21 11:51:26 2011
New Revision: 1137967

URL: http://svn.apache.org/viewvc?rev=1137967&view=rev
Log:
Extend the tests for path canonicalization, and fix a bug thus found.

* subversion/libsvn_subr/dirent_uri.c
  (canonicalize): Remove a colon that appears before an empty port-number
    component in a URI.

* subversion/tests/libsvn_subr/dirent_uri-test.c
  (test_dirent_is_canonical, test_relpath_is_canonical,
   test_uri_is_canonical): Check also that if the string under test is
   supposed to be non-canonical but canonicalizable, then the canonicalize()
   function modifies it.

Modified:
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c
    subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1137967&r1=1137966&r2=1137967&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Tue Jun 21 11:51:26 2011
@@ -385,6 +385,10 @@ canonicalize(path_type_t type, const cha
                 {
                   src += 5;
                 }
+              else if (src[1] == '/' || !src[1])
+                {
+                  src += 1;
+                }
 
               while (*src && (*src != '/'))
                 *(dst++) = canonicalize_to_lower((*src++));

Modified: subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1137967&r1=1137966&r2=1137967&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Tue Jun 21 11:51:26 2011
@@ -965,7 +965,8 @@ test_dirent_is_canonical(apr_pool_t *poo
 
       canonicalized = svn_dirent_canonicalize(tests[i].path, pool);
 
-      if (canonical && (strcmp(tests[i].path, canonicalized) != 0))
+      if ((canonical && strcmp(tests[i].path, canonicalized) != 0)
+          || (!canonical && strcmp(tests[i].path, canonicalized) == 0))
         return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                  "svn_dirent_canonicalize(\"%s\") returned \"%s\" "
                                  "while svn_dirent_is_canonical returned TRUE",
@@ -1057,7 +1058,8 @@ test_relpath_is_canonical(apr_pool_t *po
 
       canonicalized = svn_relpath_canonicalize(tests[i].path, pool);
 
-      if (canonical && (strcmp(tests[i].path, canonicalized) != 0))
+      if ((canonical && strcmp(tests[i].path, canonicalized) != 0)
+          || (!canonical && strcmp(tests[i].path, canonicalized) == 0))
         return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                  "svn_relpath_canonicalize(\"%s\") returned "
                                  "\"%s\"  while svn_relpath_is_canonical "
@@ -1202,7 +1204,8 @@ test_uri_is_canonical(apr_pool_t *pool)
 
       canonicalized = svn_uri_canonicalize(tests[i].path, pool);
 
-      if (canonical && (strcmp(tests[i].path, canonicalized) != 0))
+      if ((canonical && strcmp(tests[i].path, canonicalized) != 0)
+          || (!canonical && strcmp(tests[i].path, canonicalized) == 0))
         return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                  "svn_uri_canonicalize(\"%s\") returned \"%s\" "
                                  "while svn_uri_is_canonical returned %s",



Mime
View raw message