You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2012/08/01 06:03:18 UTC

svn commit: r1367853 - in /subversion/branches/1.7.x: ./ STATUS subversion/libsvn_subr/dirent_uri.c

Author: svn-role
Date: Wed Aug  1 04:03:17 2012
New Revision: 1367853

URL: http://svn.apache.org/viewvc?rev=1367853&view=rev
Log:
Merge the r1354876 group from trunk:

 * r1354876, r1354907, r1355340
   Allow non-existing but valid canonical absolute paths to pass through
   svn_dirent_get_absolute().
   Justification:
     Resolves a few user reported problems.
   Notes:
     r1354907 undoes r1354876, and r1355340 fixes a return problem, so
     it is easiest to review them as a single patch.
   Votes:
     +1: rhuijben, cmpilato, philip

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1354876,1354907,1355340

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1367853&r1=1367852&r2=1367853&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed Aug  1 04:03:17 2012
@@ -81,17 +81,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1354876, r1354907, r1355340
-   Allow non-existing but valid canonical absolute paths to pass through
-   svn_dirent_get_absolute().
-   Justification:
-     Resolves a few user reported problems.
-   Notes:
-     r1354907 undoes r1354876, and r1355340 fixes a return problem, so
-     it is easiest to review them as a single patch.
-   Votes:
-     +1: rhuijben, cmpilato, philip
-
  * r1361007, r1361019
    Don't record references to files in the system temp directory from
    workqueue operations from the merge code.

Modified: subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c?rev=1367853&r1=1367852&r2=1367853&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c Wed Aug  1 04:03:17 2012
@@ -1604,10 +1604,32 @@ svn_dirent_get_absolute(const char **pab
                                APR_FILEPATH_NOTRELATIVE,
                                pool);
   if (apr_err)
-    return svn_error_createf(SVN_ERR_BAD_FILENAME,
-                             svn_error_create(apr_err, NULL, NULL),
-                             _("Couldn't determine absolute path of '%s'"),
-                             svn_dirent_local_style(relative, pool));
+    {
+      /* In some cases when the passed path or its ancestor(s) do not exist
+         or no longer exist apr returns an error.
+
+         In many of these cases we would like to return a path anyway, when the
+         passed path was already a safe absolute path. So check for that now to
+         avoid an error.
+
+         svn_dirent_is_absolute() doesn't perform the necessary checks to see
+         if the path doesn't need post processing to be in the canonical absolute
+         format.
+         */
+
+      if (svn_dirent_is_absolute(relative)
+          && svn_dirent_is_canonical(relative, pool)
+          && !svn_path_is_backpath_present(relative))
+        {
+          *pabsolute = apr_pstrdup(pool, relative);
+          return SVN_NO_ERROR;
+        }
+
+      return svn_error_createf(SVN_ERR_BAD_FILENAME,
+                               svn_error_create(apr_err, NULL, NULL),
+                               _("Couldn't determine absolute path of '%s'"),
+                               svn_dirent_local_style(relative, pool));
+    }
 
   SVN_ERR(svn_path_cstring_to_utf8(pabsolute, buffer, pool));
   *pabsolute = svn_dirent_canonicalize(*pabsolute, pool);