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

Re: svn commit: r1834612 - in /subversion/branches/1.10.x-issue4758/subversion: libsvn_client/shelve.c tests/cmdline/shelve_tests.py

From: Philip Martin <philip_at_codematters.co.uk>
Date: Thu, 28 Jun 2018 18:22:49 +0100

julianfoad_at_apache.org writes:

> Author: julianfoad
> Date: Thu Jun 28 13:50:28 2018
> New Revision: 1834612
>
> URL: http://svn.apache.org/viewvc?rev=1834612&view=rev
> Log:
> On the '1.10.x-issue4758' branch: Fix SVN-4758 "Unable to shelve changes
> when using custom diff-cmd".

> + /* Ensure we use internal diff, not any configured external diff-cmd. */
> + old_config = ctx->config;
> + ctx->config = NULL;
> +
> for (i = 0; i < paths->nelts; i++)
> {
> const char *path = APR_ARRAY_IDX(paths, i, const char *);
> @@ -216,6 +221,9 @@ shelf_write_patch(const char *name,
> changelists,
> ctx, iterpool));
> }
> +
> + ctx->config = old_config;
> +
> SVN_ERR(svn_stream_close(outstream));
> SVN_ERR(svn_stream_close(errstream));

There are SVN_ERR between these two hunks. If one of these returns an
error we will fail to restore the old config.

I did also worry about thread safety: it's not safe to modify the
context like that if the context can be shared across multiple threads.
However the context also includes batons and those typically point to
mutable data which cannot be shared across threads either. I suppose we
should document that a client should only access a context from one
thread at a time.

-- 
Philip
Received on 2018-06-28 19:23:06 CEST

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