On '1.7.x-issue4263' branch: Merge r1423585 from trunk.
Clean merge.
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.7.x-issue4263@1423594 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/svnrdump/load_editor.c b/subversion/svnrdump/load_editor.c
index 0419446..00e34be 100644
--- a/subversion/svnrdump/load_editor.c
+++ b/subversion/svnrdump/load_editor.c
@@ -729,6 +729,8 @@
{
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)
@@ -808,6 +810,8 @@
}
}
+ SVN_ERR(svn_rdump__normalize_prop(name, &value, pool));
+
SVN_ERR(svn_repos__validate_prop(name, value, pool));
switch (nb->kind)
diff --git a/subversion/svnrdump/svnrdump.h b/subversion/svnrdump/svnrdump.h
index 1febb5a..9bc184ef 100644
--- a/subversion/svnrdump/svnrdump.h
+++ b/subversion/svnrdump/svnrdump.h
@@ -85,6 +85,20 @@
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 */
diff --git a/subversion/svnrdump/util.c b/subversion/svnrdump/util.c
index edf9c8f..c6e0268 100644
--- a/subversion/svnrdump/util.c
+++ b/subversion/svnrdump/util.c
@@ -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 @@
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);
}
diff --git a/subversion/tests/cmdline/svnrdump_tests.py b/subversion/tests/cmdline/svnrdump_tests.py
index 380ce71..672881f 100755
--- a/subversion/tests/cmdline/svnrdump_tests.py
+++ b/subversion/tests/cmdline/svnrdump_tests.py
@@ -375,7 +375,6 @@
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"