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

Re: svn commit: r1126731 - /subversion/trunk/subversion/libsvn_wc/update_editor.c

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 23 May 2011 22:50:56 +0200

On Mon, May 23, 2011 at 08:39:39PM -0000, stsp_at_apache.org wrote:
> Author: stsp
> Date: Mon May 23 20:39:38 2011
> New Revision: 1126731
>
> URL: http://svn.apache.org/viewvc?rev=1126731&view=rev
> Log:
> * subversion/libsvn_wc/update_editor.c
> (window_handler): If closing the checksum stream fails for some reason
> do not try to dereference the hb->actual_source_checksum pointer since
> it may be NULL.

Just a note that this problem isn't as severe as it may sound:

I found this while playing around with compressed pristines.
Because the checksum stream wrapped a compressed stream, if decompression
failed an error was thrown before the checksum close handler could generate
a checksum.

The assumption that a checksum is generated even if an error is
thrown from the close handler was a bug which never triggered with
the current trunk code.

> Modified:
> subversion/trunk/subversion/libsvn_wc/update_editor.c
>
> Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1126731&r1=1126730&r2=1126731&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon May 23 20:39:38 2011
> @@ -882,21 +882,24 @@ window_handler(svn_txdelta_window_t *win
> /* Close the stream to calculate HB->actual_source_md5_checksum. */
> svn_error_t *err2 = svn_stream_close(hb->source_checksum_stream);
>
> - SVN_ERR_ASSERT(hb->expected_source_checksum->kind ==
> - hb->actual_source_checksum->kind);
> -
> - if (!err2 && !svn_checksum_match(hb->expected_source_checksum,
> - hb->actual_source_checksum))
> + if (!err2)
> {
> - err = svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, err,
> - _("Checksum mismatch while updating '%s':\n"
> - " expected: %s\n"
> - " actual: %s\n"),
> - svn_dirent_local_style(fb->local_abspath, hb->pool),
> - svn_checksum_to_cstring(hb->expected_source_checksum,
> - hb->pool),
> - svn_checksum_to_cstring(hb->actual_source_checksum,
> - hb->pool));
> + SVN_ERR_ASSERT(hb->expected_source_checksum->kind ==
> + hb->actual_source_checksum->kind);
> +
> + if (!svn_checksum_match(hb->expected_source_checksum,
> + hb->actual_source_checksum))
> + {
> + err = svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, err,
> + _("Checksum mismatch while updating '%s':\n"
> + " expected: %s\n"
> + " actual: %s\n"),
> + svn_dirent_local_style(fb->local_abspath, hb->pool),
> + svn_checksum_to_cstring(hb->expected_source_checksum,
> + hb->pool),
> + svn_checksum_to_cstring(hb->actual_source_checksum,
> + hb->pool));
> + }
> }
>
> err = svn_error_compose_create(err, err2);
>
Received on 2011-05-23 22:51:29 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.