stsp_at_apache.org writes:
> Author: stsp
> Date: Fri Jan 22 22:50:42 2010
> New Revision: 902303
> +svn_error_t *
> +svn_wc__call_with_write_lock(svn_wc__with_write_lock_func_t func,
> + void *baton,
> + svn_wc_context_t *wc_ctx,
> + const char *local_abspath,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN_ERR(svn_wc__acquire_write_lock(NULL, wc_ctx, local_abspath,
> + scratch_pool, scratch_pool));
> + return svn_error_compose_create(
> + func(baton, result_pool, scratch_pool),
> + svn_wc__release_write_lock(wc_ctx, local_abspath, scratch_pool));
> +}
That's not going to work because the two function calls func() and
svn_wc__release_write_lock() are not evaluated in any particular
order. It needs to be something like:
Index: subversion/libsvn_wc/lock.c
===================================================================
--- subversion/libsvn_wc/lock.c (revision 903527)
+++ subversion/libsvn_wc/lock.c (working copy)
@@ -1857,9 +1857,10 @@
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+ svn_error_t *err1, *err2;
SVN_ERR(svn_wc__acquire_write_lock(NULL, wc_ctx, local_abspath,
scratch_pool, scratch_pool));
- return svn_error_compose_create(
- func(baton, result_pool, scratch_pool),
- svn_wc__release_write_lock(wc_ctx, local_abspath, scratch_pool));
+ err1 = func(baton, result_pool, scratch_pool);
+ err2 = svn_wc__release_write_lock(wc_ctx, local_abspath, scratch_pool);
+ return svn_error_compose_create(err1, err2);
}
However, if I make that change I get several test failures:
$ ../../../../src/subversion/tests/cmdline/patch_tests.py --parallel
F.FF.F.
The tests pass if I reverse the two function calls but obviously that
makes the locking pointless:
Index: subversion/libsvn_wc/lock.c
===================================================================
--- subversion/libsvn_wc/lock.c (revision 903527)
+++ subversion/libsvn_wc/lock.c (working copy)
@@ -1857,9 +1857,10 @@
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
+ svn_error_t *err1, *err2;
SVN_ERR(svn_wc__acquire_write_lock(NULL, wc_ctx, local_abspath,
scratch_pool, scratch_pool));
- return svn_error_compose_create(
- func(baton, result_pool, scratch_pool),
- svn_wc__release_write_lock(wc_ctx, local_abspath, scratch_pool));
+ err2 = svn_wc__release_write_lock(wc_ctx, local_abspath, scratch_pool);
+ err1 = func(baton, result_pool, scratch_pool);
+ return svn_error_compose_create(err1, err2);
}
--
Philip
Received on 2010-01-27 03:39:42 CET