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

RE: svn commit: rev 4882 - trunk/subversion/libsvn_fs

From: Sander Striker <striker_at_apache.org>
Date: 2003-02-13 20:50:14 CET

> From: sussman@tigris.org [mailto:sussman@tigris.org]
> Sent: Thursday, February 13, 2003 8:16 PM

> apr_md5_final() may be called more than once if we ever retry_txn().
> This invalidates our apr_md5_ctx_t structure, causing a bogus checksum
> to be produced (& stored) on the second call to apr_md5_final().
> The solution is always call apr_md5_final() on a temporary copy of the
> structure... inspired by a patch from Brandon Ehle.
>
> BTW: this change allows me to run three simultaneous stress.pl
> processes with no problems, for an indefinite amount of time.
>
> * reps-strings.c (txn_body_write_close_rep): always call apr_md5_final()
> on a temporary copy of the apr_md5_cxt_t.

> - apr_md5_final (digest, &(wb->md5_context));
> + /* apr_md5_final() invalidates the md5_context structure. But if we
> + ever retry_txn(), this whole routine may run again, so we need to
> + preserve our original md5_context.
> +
> + ### Because apr_md5_ctx_t is transparent and shallow, the
> + memcpy() below is safe. But ideally, we'd want something like
> + apr_md5_ctx_dup() in the future.
> + */
> + memcpy (&tmp_context, &(wb->md5_context), sizeof(tmp_context));
> + apr_md5_final (digest, &tmp_context);

Bah. Just cache the md5 digest in the baton in close_stream.
txn_body_write_close_rep can use it directly from there. No hacky memcpy
or apr_md5_ctx_dup needed.

Sander

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 13 20:50:57 2003

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