subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1423585 - in /subversion/trunk/subversion: svnrdump/load_editor.c svnrdump/svnrdump.h svnrdump/util.c tests/cmdline/svnrdump_tests.py
Date Tue, 18 Dec 2012 19:17:17 GMT
Author: breser
Date: Tue Dec 18 19:17:15 2012
New Revision: 1423585

URL: http://svn.apache.org/viewvc?rev=1423585&view=rev
Log:
Fix issue #4263: svnrdump: E125005: Cannot accept non-LF line endings in
'svn:log' property

Fix to ensure that no "\r" characters are present in revision or node
props.

In the case of "\r\n" character sequences, the "\r" is removed.

In the case of "\r" characters which are not followed by "\n", the "\r"
is replaced by a "\n" character.

* subversion/svnrdump/svnrdump.h:
   (svn_rdump__normalize_prop): New function declaration.

* subversion/svnrdump/util.c:
   (svn_rdump__normalize_prop): New function to allow "svnrdump load" to
     use existing logic
   (svn_rdump__normalize_props): Refactored to move logic into
     svn_rdump__normalize_prop()

* subversion/svnrdump/load_editor.c:
   (set_revision_property): Added call to svn_rdump__normalize_prop()
   (set_node_property): Added call to svn_rdump__normalize_prop()

* subversion/tests/cmdline/svnrdump_tests.py:
   (copy_bad_line_endings_load): Removed "XFail" decorator

Patch by: Gabriela Gibson <gabriela.gibson@gmail.com>

Modified:
    subversion/trunk/subversion/svnrdump/load_editor.c
    subversion/trunk/subversion/svnrdump/svnrdump.h
    subversion/trunk/subversion/svnrdump/util.c
    subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py

Modified: subversion/trunk/subversion/svnrdump/load_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/load_editor.c?rev=1423585&r1=1423584&r2=1423585&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/load_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/load_editor.c Tue Dec 18 19:17:15 2012
@@ -855,6 +855,8 @@ set_revision_property(void *baton,
 {
   struct revision_baton *rb = baton;
 
+  SVN_ERR(svn_rdump__normalize_prop(name, &value, rb->pool));
+  
   SVN_ERR(svn_repos__validate_prop(name, value, rb->pool));
 
   if (rb->rev > 0)
@@ -934,6 +936,8 @@ set_node_property(void *baton,
         }
     }
 
+  SVN_ERR(svn_rdump__normalize_prop(name, &value, pool));
+
   SVN_ERR(svn_repos__validate_prop(name, value, pool));
 
   switch (nb->kind)

Modified: subversion/trunk/subversion/svnrdump/svnrdump.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.h?rev=1423585&r1=1423584&r2=1423585&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.h (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.h Tue Dec 18 19:17:15 2012
@@ -106,6 +106,20 @@ svn_rdump__normalize_props(apr_hash_t **
                            apr_hash_t *props,
                            apr_pool_t *result_pool);
 
+/* Normalize the line ending style of a single property that "needs
+ * translation" (according to svn_prop_needs_translation(),
+ * currently all svn:* props) so that they contain only LF (\n) line endings.
+ * "\r" characters found mid-line are replaced with "\n".
+ * "\r\n" sequences are replaced with "\n"
+ *
+ * NAME is used to check that VALUE should be normalized, and if this is the
+ * case, VALUE is then normalized, allocated from RESULT_POOL
+ */
+svn_error_t *
+svn_rdump__normalize_prop(const char *name,
+                          const svn_string_t **value,
+                          apr_pool_t *result_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/svnrdump/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/util.c?rev=1423585&r1=1423584&r2=1423585&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/util.c (original)
+++ subversion/trunk/subversion/svnrdump/util.c Tue Dec 18 19:17:15 2012
@@ -31,6 +31,25 @@
 
 
 svn_error_t *
+svn_rdump__normalize_prop(const char *name,
+                          const svn_string_t **value,
+                          apr_pool_t *result_pool)
+{
+  if (svn_prop_needs_translation(name))
+    {
+      const char *cstring;
+
+      SVN_ERR(svn_subst_translate_cstring2((*value)->data, &cstring,
+                                           "\n", TRUE,
+                                           NULL, FALSE,
+                                           result_pool));
+
+      *value = svn_string_create(cstring, result_pool);
+    }
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_rdump__normalize_props(apr_hash_t **normal_props,
                            apr_hash_t *props,
                            apr_pool_t *result_pool)
@@ -45,16 +64,8 @@ svn_rdump__normalize_props(apr_hash_t **
       const char *key = svn__apr_hash_index_key(hi);
       const svn_string_t *value = svn__apr_hash_index_val(hi);
 
-      if (svn_prop_needs_translation(key))
-        {
-          const char *cstring;
-
-          SVN_ERR(svn_subst_translate_cstring2(value->data, &cstring,
-                                               "\n", TRUE,
-                                               NULL, FALSE,
-                                               result_pool));
-          value = svn_string_create(cstring, result_pool);
-        }
+      SVN_ERR(svn_rdump__normalize_prop(key, &value,
+                                        result_pool));
 
       apr_hash_set(*normal_props, key, APR_HASH_KEY_STRING, value);
     }

Modified: subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py?rev=1423585&r1=1423584&r2=1423585&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py Tue Dec 18 19:17:15 2012
@@ -358,7 +358,6 @@ def copy_bad_line_endings_dump(sbox):
                 expected_dumpfile_name="copy-bad-line-endings.expected.dump",
                 bypass_prop_validation=True)
 
-@XFail()
 @Issue(4263)
 def copy_bad_line_endings_load(sbox):
   "load: inconsistent line endings in svn:* props"



Mime
View raw message