You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/03/27 15:16:30 UTC
svn commit: r1461592 - in /subversion/branches/1.7.x-issue4340: ./
subversion/libsvn_fs/fs-loader.c subversion/tests/libsvn_fs/fs-test.c
Author: stsp
Date: Wed Mar 27 14:16:30 2013
New Revision: 1461592
URL: http://svn.apache.org/r1461592
Log:
Backport fix for issue #4340, "fs layer should reject filenames with
trailing \n", to the 1.7.x-issue4340 branch.
Merge r1461562 and r1461580 from trunk, resolving a text conflict
with the former revision, and a tree conflict with the latter revision.
* subversion/libsvn_fs/editor.c: This file doesn't exist in 1.7.x,
so this change on trunk doesn't apply.
* subversion/libsvn_fs/fs-loader.c: Fix a text conflict caused by the
existence of additional new tests in trunk. Tweak the test to not
rely on SVN_TEST_ASSERT_ERROR which doesn't exist in 1.7.x.
Modified:
subversion/branches/1.7.x-issue4340/ (props changed)
subversion/branches/1.7.x-issue4340/subversion/libsvn_fs/fs-loader.c
subversion/branches/1.7.x-issue4340/subversion/tests/libsvn_fs/fs-test.c
Propchange: subversion/branches/1.7.x-issue4340/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1461562,1461580
Modified: subversion/branches/1.7.x-issue4340/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340/subversion/libsvn_fs/fs-loader.c?rev=1461592&r1=1461591&r2=1461592&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4340/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/1.7.x-issue4340/subversion/libsvn_fs/fs-loader.c Wed Mar 27 14:16:30 2013
@@ -367,6 +367,9 @@ svn_fs__path_valid(const char *path, apr
path);
}
+ /* No control characters (see issue #4340). */
+ SVN_ERR(svn_path_check_valid(path, pool));
+
/* That's good enough. */
return SVN_NO_ERROR;
}
Modified: subversion/branches/1.7.x-issue4340/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340/subversion/tests/libsvn_fs/fs-test.c?rev=1461592&r1=1461591&r2=1461592&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4340/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/1.7.x-issue4340/subversion/tests/libsvn_fs/fs-test.c Wed Mar 27 14:16:30 2013
@@ -4799,6 +4799,47 @@ node_origin_rev(const svn_test_opts_t *o
return SVN_NO_ERROR;
}
+/* Issue 4340, "fs layer should reject filenames with trailing \n" */
+static svn_error_t *
+filename_trailing_newline(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ apr_pool_t *subpool = svn_pool_create(pool);
+ svn_fs_t *fs;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root, *root;
+ svn_revnum_t youngest_rev = 0;
+ svn_error_t *err;
+
+ SVN_ERR(svn_test__create_fs(&fs, "test-filename-trailing-newline",
+ opts, pool));
+
+/* ------------------------------------------------------------------------ */
+ /* Revision 1: Add a directory /foo */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "/foo", subpool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &youngest_rev, txn, subpool));
+ SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
+
+ /* Attempt to copy /foo to "/bar\n". This should fail. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
+ SVN_ERR(svn_fs_revision_root(&root, fs, youngest_rev, subpool));
+ err = svn_fs_copy(root, "/foo", txn_root, "/bar\n", subpool);
+ SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_FS_PATH_SYNTAX);
+ svn_error_clear(err);
+
+ /* Attempt to create a file /foo/baz\n. This should fail. */
+ err = svn_fs_make_file(txn_root, "/foo/baz\n", subpool);
+ SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_FS_PATH_SYNTAX);
+ svn_error_clear(err);
+
+ return SVN_NO_ERROR;
+}
+
+
/* ------------------------------------------------------------------------ */
/* The test table. */
@@ -4878,5 +4919,7 @@ struct svn_test_descriptor_t test_funcs[
"test svn_fs_node_origin_rev"),
SVN_TEST_OPTS_PASS(small_file_integrity,
"create and modify small file"),
+ SVN_TEST_OPTS_PASS(filename_trailing_newline,
+ "filenames with trailing \\n should be rejected"),
SVN_TEST_NULL
};