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

Re: Minor logic bug

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2001-12-14 23:19:22 CET

Applied, thanks Jeff!

If you could include a log message next time that would be great; see
the HACKING file for more.

-Karl

Jeff Squyres <jsquyres@osl.iu.edu> writes:
> I found a minor bug in the logic that checks the version of db. It
> compares each portion of the version number (major, minor, patch)
> individually instead of combining them as appropriate.
>
> Here's the code as it is now:
>
> if (major < SVN_FS_WANT_DB_MAJOR
> || minor < SVN_FS_WANT_DB_MINOR
> || patch < SVN_FS_WANT_DB_PATCH)
>
> Hence, if the desired version is 4.5.6, and the actual version is 4.6.0
> this test will still report false (because patch is less than 6, even
> though minor is greater than 5).
>
> This bit me when I tried to use DB 4.0.14 with SVN (yes, I know this is
> probably a bad idea :-). I had to do some extra work to get SVN to
> compile properly with 4.0.14 (DB's API has changed... again), but then it
> failed at run time because this test thought that the minor version "0"
> meant that DB's version was less than what it wanted. So it failed for
> the wrong reason.
>
> The patch is simple enough, and is attached.
>
> {+} Jeff Squyres
> {+} jsquyres@osl.iu.edu
> {+} Research Associate, Open Systems Lab, Indiana University
> {+} http://www.osl.iu.edu/

Attachment said:

> Index: ./subversion/libsvn_fs/fs.c
> ===================================================================
> --- ./subversion/libsvn_fs/.svn/text-base/fs.c.svn-base Thu Dec 6 18:28:49 2001
> +++ ./subversion/libsvn_fs/fs.c Fri Dec 7 16:43:14 2001
> @@ -54,9 +54,10 @@
> ### refactored to go elsewhere. note that svn_fs_new() doesn't return
> ### an error, so it isn't quite suitable. */
> db_version (&major, &minor, &patch);
> - if (major < SVN_FS_WANT_DB_MAJOR
> - || minor < SVN_FS_WANT_DB_MINOR
> - || patch < SVN_FS_WANT_DB_PATCH)
> + if ((major < SVN_FS_WANT_DB_MAJOR)
> + || (major == SVN_FS_WANT_DB_MAJOR && minor < SVN_FS_WANT_DB_MINOR)
> + || (major == SVN_FS_WANT_DB_MAJOR && minor == SVN_FS_WANT_DB_MINOR
> + && patch < SVN_FS_WANT_DB_PATCH))
> return svn_error_createf (SVN_ERR_FS_GENERAL, 0, 0, fs->pool,
> "bad database version: %d.%d.%d",
> major, minor, patch);
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:53 2006

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.