[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r902303 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_wc/lock.c

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 27 Jan 2010 09:26:05 +0100

On Wed, Jan 27, 2010 at 02:39:05AM +0000, Philip Martin wrote:
> 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.

Oh, the order depends on the compiler, right?
Good catch.

> 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:

Are these related to the svn_wc_notify_t-related issues you found?
Can we apply your patch to fix the ordering problem?

Stefan
Received on 2010-01-27 09:26:45 CET

This is an archived mail posted to the Subversion Dev mailing list.