julianf...@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

Reply via email to