Author: stefan2
Date: Sun Sep 3 15:02:16 2017
New Revision: 1807154
URL: http://svn.apache.org/viewvc?rev=1807154&view=rev
Log:
Fix the authz test failures caused by the latest tree conflict resolution UI
improvements.
The problem is triggered when we try to gather details for a given conflict
to present those details to the user such that they may make a well-informed
decision about how to proceed. If that user fails to authenticate with
sufficient access rights, we can't gather that data.
Instead of bailing out with an error, we now gracefully degrade to displaying
only reduced (client-only) conflict info, if there was an authz failure.
Ideally, we would mention that failure in the conflict info as well but that
can be done at some point in the future.
* subversion/libsvn_client/conflicts.c
(ignore_authz_failures): New utility function.
(svn_client_conflict_tree_get_details): Ignore authz failures and proceed
with whatever information we have.
Modified:
subversion/trunk/subversion/libsvn_client/conflicts.c
Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1807154&r1=1807153&r2=1807154&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Sun Sep 3 15:02:16
2017
@@ -9713,6 +9713,21 @@ svn_client_conflict_tree_get_resolution_
return SVN_NO_ERROR;
}
+/* Swallow authz failures and return SVN_NO_ERROR in that case.
+ * Otherwise, return ERR unchanged. */
+static svn_error_t *
+ignore_authz_failures(svn_error_t *err)
+{
+ if (err && ( (err->apr_err == SVN_ERR_AUTHZ_UNREADABLE)
+ || (err->apr_err == SVN_ERR_RA_NOT_AUTHORIZED)))
+ {
+ svn_error_clear(err);
+ err = SVN_NO_ERROR;
+ }
+
+ return err;
+}
+
svn_error_t *
svn_client_conflict_tree_get_details(svn_client_conflict_t *conflict,
svn_client_ctx_t *ctx,
@@ -9732,13 +9747,18 @@ svn_client_conflict_tree_get_details(svn
scratch_pool);
}
+ /* Collecting conflict details may fail due to insufficient access rights.
+ * This is not a failure but simply restricts our future options. */
if (conflict->tree_conflict_get_incoming_details_func)
- SVN_ERR(conflict->tree_conflict_get_incoming_details_func(conflict, ctx,
- scratch_pool));
+ SVN_ERR(ignore_authz_failures(
+ conflict->tree_conflict_get_incoming_details_func(conflict, ctx,
+ scratch_pool)));
+
if (conflict->tree_conflict_get_local_details_func)
- SVN_ERR(conflict->tree_conflict_get_local_details_func(conflict, ctx,
- scratch_pool));
+ SVN_ERR(ignore_authz_failures(
+ conflict->tree_conflict_get_local_details_func(conflict, ctx,
+ scratch_pool)));
if (ctx->notify_func2)
{