You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/08/29 18:36:26 UTC
svn commit: r1378634 - /subversion/trunk/subversion/libsvn_ra_serf/update.c
Author: cmpilato
Date: Wed Aug 29 16:36:26 2012
New Revision: 1378634
URL: http://svn.apache.org/viewvc?rev=1378634&view=rev
Log:
Finish issue #3993 ("serf corrupts wc by calling close_edit for an
incomplete update-report").
* subversion/libsvn_ra_serf/update.c
(report_context_t): Add 'report_completed' flag.
(end_report): Toggle the new 'report_completed' flag once we've seen
the closing update-report tag.
(finish_report): Only call the update editor's close_edit() if we
saw the closing update-report tag; otherwise, raise an error.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/update.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1378634&r1=1378633&r2=1378634&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Wed Aug 29 16:36:26 2012
@@ -358,6 +358,9 @@ struct report_context_t {
/* Are we done parsing the REPORT response? */
svn_boolean_t done;
+ /* Did we get a complete (non-truncated) report? */
+ svn_boolean_t report_completed;
+
/* The XML parser context for the REPORT response. */
svn_ra_serf__xml_parser_t *parser_ctx;
};
@@ -1862,8 +1865,15 @@ end_report(svn_ra_serf__xml_parser_t *pa
if (state == NONE)
{
- /* nothing to close yet. */
- return SVN_NO_ERROR;
+ if (strcmp(name.name, "update-report") == 0)
+ {
+ ctx->report_completed = TRUE;
+ }
+ else
+ {
+ /* nothing to close yet. */
+ return SVN_NO_ERROR;
+ }
}
if (((state == OPEN_DIR && (strcmp(name.name, "open-directory") == 0)) ||
@@ -2627,7 +2637,12 @@ finish_report(void *report_baton,
SVN_ERR(close_all_dirs(report->root_dir));
}
- err = report->update_editor->close_edit(report->update_baton, iterpool);
+ /* If we got a complete report, close the edit. Otherwise, abort it. */
+ if (report->report_completed)
+ err = report->update_editor->close_edit(report->update_baton, iterpool);
+ else
+ err = svn_error_create(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
+ _("Missing update-report close tag"));
svn_pool_destroy(iterpool);
return svn_error_trace(err);