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

Re: checksum bug, a great mystery.

From: Brandon Ehle <azverkan_at_yahoo.com>
Date: 2003-02-12 23:45:12 CET

>>Then within 5 to 30 seconds, you'll get a commit error in the second
>>shell like this:
>>Transmitting file data ..subversion/libsvn_client/commit.c:669: (apr_err=200014)svn: A checksum mismatch occurred
>>svn: Commit failed (details follow):
>>subversion/libsvn_fs/dag.c:1391: (apr_err=200014)
>>svn: svn_fs__dag_finalize_edits: checksum mismatch, rep "1o":
>> expected: 69e5c7f96d30e12e4707fb13637aceab
>> actual: b0e641c998cc3eae6fa2f8726d98cddd
As mentioned before the key is what happens with apr_md5_final() get
called with an empty context. The reason this is happening is because
apr_md5_final() can only be called once on a given context, as it will
clear the context after handing you the checksum. In this case its
because txn_body_write_close_rep() is calling apr_md5_final() twice on
the same context. If you add this patch, the error will go away.

Index: subversion/libsvn_fs/reps-strings.c
--- subversion/libsvn_fs/reps-strings.c (revision 4860)
+++ subversion/libsvn_fs/reps-strings.c (working copy)
@@ -1044,6 +1044,7 @@
   struct rep_write_baton *wb = baton;
   unsigned char digest[MD5_DIGESTSIZE];
   svn_fs__representation_t *rep;
+ apr_md5_ctx_t tempContext;

   /* ### Thought: if we fixed apr-util MD5 contexts to allow repeated
      digestification, then we wouldn't need a stream close function at
@@ -1053,7 +1054,9 @@
      a checksum mismatch, it just happens that our code never tries to
      do that anyway. */

+ memcpy(&tempContext, &(wb->md5_context), sizeof(apr_md5_ctx_t));
   apr_md5_final (digest, &(wb->md5_context));
+ memcpy(&(wb->md5_context), &tempContext, sizeof(apr_md5_ctx_t));

   SVN_ERR (svn_fs__bdb_read_rep (&rep, wb->fs, wb->rep_key, trail));
   memcpy (rep->checksum, digest, MD5_DIGESTSIZE);

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 12 23:44:34 2003

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