[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bugfix for cvsweb: revcmp sometimes returns incorrect result

From: erik . cumps
Subject: Bugfix for cvsweb: revcmp sometimes returns incorrect result
Date: Tue, 7 Jan 2003 11:29:12 +0100

Hello *,

I sent the following mail to Zeller and the cvsweb mailing list some
time ago to indicate (and fix) a problem with cvsweb. Having seen
no response yet I decided to share the info with you because I
figured there are still a lot of people using cvsweb...


----- Forwarded by Erik Cumps/ICOS on 07/01/2003 11:21 AM -----

Erik Cumps
28/11/2002 03:05 PM

        To:     address@hidden
        cc:     address@hidden
        Subject:        Bugfix for cvsweb: revcmp sometimes returns incorrect 


  I have been using cvsweb for a long time now but only recently I
discovered what I consider a bug in the revision comparison

  More to the point, when selecting a diff between two revisions the
order is sometimes wrong and the diff shows the newest revision
on the left-hand side, the oldest on the other side.

  This happens when a revision number contains the number '0'
as part of the revision number, as in for example. In this
case the revcmp subroutine will bail out too early while shifting
the revision sub-numbers from the revision array. This happens
because it tests for non-zero, which means undefined values
as well as zero values will cause it to abort the loop.

  Additionally the post-loop test to determine which, if any, of
the two revision numbers is longest performs a bad test: at
that point one or more shifts have failed because the corresponding
array was empty. The other shift will still have succeeded
though and might have emptied the array at that point. The
subroutine would then conclude that both revision numbers
are equal because both arrays are empty.

  Because I am using version 1.93 of cvsweb I have retrieved the
latest version from the web, v1.112, and after examination I
consluded that this version shows the same problem.

  I have attached a patch which fixes this problem, and hope you
will find it useful. I have applied the patch to our installed version
and it works great. Every diff now has the revisions in the right

  Since revcmp is used in other places as well I suspect this
patch will fix apparent problems in other aspects of cvsweb
although I must admit I never noticed any. Maybe they are
just not obvious?

  I have taken a look at the 'new' freeBSD cvsweb and this one
exhibits the problem too. I therefore took the liberty to also send
this mail to the freeBSD cvsweb mailing list.

Attachment: cvsweb.cgi.revcmp.patch-2
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]