You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/10/15 19:36:39 UTC
svn commit: r1398413 - in /subversion/branches/auto-props-sdc/subversion:
libsvn_client/add.c tests/cmdline/autoprop_tests.py
Author: pburba
Date: Mon Oct 15 17:36:39 2012
New Revision: 1398413
URL: http://svn.apache.org/viewvc?rev=1398413&view=rev
Log:
On the auto-props-sdc branch: Fix a segfault.
* subversion/libsvn_client/add.c
(add_dir_recursive): Reset output argument when the pool used to allocate
it is destroyed.
* subversion/tests/cmdline/autoprop_tests.py
(svn_config_autoprops_unversioned_subtrees_versioned_target): New.
(test_list): Add
svn_config_autoprops_unversioned_subtrees_versioned_target.
Modified:
subversion/branches/auto-props-sdc/subversion/libsvn_client/add.c
subversion/branches/auto-props-sdc/subversion/tests/cmdline/autoprop_tests.py
Modified: subversion/branches/auto-props-sdc/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/branches/auto-props-sdc/subversion/libsvn_client/add.c?rev=1398413&r1=1398412&r2=1398413&view=diff
==============================================================================
--- subversion/branches/auto-props-sdc/subversion/libsvn_client/add.c (original)
+++ subversion/branches/auto-props-sdc/subversion/libsvn_client/add.c Mon Oct 15 17:36:39 2012
@@ -402,6 +402,7 @@ add_dir_recursive(const char *dir_abspat
apr_hash_t *dirents;
apr_hash_index_t *hi;
svn_boolean_t entry_exists = FALSE;
+ svn_boolean_t found_unversioned_root = FALSE;
/* Check cancellation; note that this catches recursive calls too. */
if (ctx->cancel_func)
@@ -433,6 +434,7 @@ add_dir_recursive(const char *dir_abspat
SVN_ERR(svn_client__get_all_auto_props(config_autoprops, dir_abspath,
ctx, result_pool,
scratch_pool));
+ found_unversioned_root = TRUE;
}
if (!no_ignore)
@@ -496,6 +498,11 @@ add_dir_recursive(const char *dir_abspat
/* Destroy the per-iteration pool. */
svn_pool_destroy(iterpool);
+ /* Reset CONFIG_AUTOPROPS if we just finished processing the root
+ of an unversioned subtree. */
+ if (found_unversioned_root)
+ *config_autoprops = NULL;
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/auto-props-sdc/subversion/tests/cmdline/autoprop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/auto-props-sdc/subversion/tests/cmdline/autoprop_tests.py?rev=1398413&r1=1398412&r2=1398413&view=diff
==============================================================================
--- subversion/branches/auto-props-sdc/subversion/tests/cmdline/autoprop_tests.py (original)
+++ subversion/branches/auto-props-sdc/subversion/tests/cmdline/autoprop_tests.py Mon Oct 15 17:36:39 2012
@@ -623,6 +623,51 @@ def svn_config_autoprops_propset_file_ta
'ps', SVN_CONFIG_AUTOPROPS, '*.c=svn:eol-style=native',
sbox.ospath('iota'))
+#----------------------------------------------------------------------
+# Multiple unversioned subtrees under a versioned target shouldn't segfault.
+def svn_config_autoprops_unversioned_subtrees_versioned_target(sbox):
+ "versioned target and unversioned subtrees"
+
+ sbox.build()
+ Z_path = sbox.ospath('A/D/Z')
+ Y_path = sbox.ospath('A/B/Y')
+ foo_path = sbox.ospath('A/D/Z/foo.c')
+ bar_path = sbox.ospath('A/B/Y/bar.c')
+
+ # Set svn:inheritable-auto-props properties on two directories.
+ svntest.main.run_svn(None, 'ps', SVN_CONFIG_AUTOPROPS,
+ '*.c=svn:eol-style=CR', sbox.ospath('A/B'))
+ svntest.main.run_svn(None, 'ps', SVN_CONFIG_AUTOPROPS,
+ '*.c=svn:eol-style=native', sbox.ospath('A/D'))
+ svntest.main.run_svn(None, 'ci', '-m', 'Add inheritable autoprops',
+ sbox.wc_dir)
+
+ # Create two subtrees, each with one new file.
+ os.mkdir(Z_path)
+ os.mkdir(Y_path)
+ svntest.main.file_write(foo_path,
+ '/* Someday there will be code here. */\n')
+ svntest.main.file_write(bar_path,
+ '/* Someday there will be code here. */\n')
+
+ # Perform the add with the --force flag, targeting the root of the WC.
+ ### Note: You have to be inside the working copy or else Subversion
+ ### will think you're trying to add the working copy to its parent
+ ### directory, and will (possibly, if the parent directory isn't
+ ### versioned) fail -- see also schedule_tests.py 11 "'svn add'
+ ### should traverse already-versioned dirs"
+ saved_wd = os.getcwd()
+ os.chdir(sbox.wc_dir)
+ # This was causing a segfault at one point.
+ svntest.main.run_svn(None, 'add', '.', '--force')
+ os.chdir(saved_wd)
+
+ # Check the resulting autoprops.
+ svntest.actions.run_and_verify_svn(None, 'native\n', [],
+ 'pg', 'svn:eol-style', foo_path)
+ svntest.actions.run_and_verify_svn(None, 'CR\n', [],
+ 'pg', 'svn:eol-style', bar_path)
+
########################################################################
# Run the tests
@@ -658,6 +703,7 @@ test_list = [ None,
svn_config_autoprops_imp_yes_no,
svn_config_autoprops_add_versioned_target,
svn_config_autoprops_propset_file_target,
+ svn_config_autoprops_unversioned_subtrees_versioned_target,
]
if __name__ == '__main__':