Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 21392 - rpmvercmp ordering imperfect
Summary: rpmvercmp ordering imperfect
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2000-11-27 21:03 UTC by Greg Hudson
Modified: 2007-04-18 16:30 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-11-27 21:03:20 UTC

Attachments (Terms of Use)

Description Greg Hudson 2000-11-27 21:03:18 UTC
I was looking over the rpmvercmp() code and noticed that:

	rpmvercmp("1.", "1.a") -> -1
	rpmvercmp("1.a", "1.") -> -1

because of the following two lines of code:

	/* take care of the case where the two version segments are */
	/* different types: one numeric and one alpha */
	if (one == str1) return -1;	/* arbitrary */
	if (two == str2) return -1;

Perhaps the (two == str2) case should return 1 instead of -1.  The comments
also seem off; the (one == str1) case occurs only when the first segment is
empty, for instance.

Comment 1 Jeff Johnson 2001-03-15 14:15:56 UTC
Added to rpm CVS. Thanks for noticing.

Note You need to log in before you can comment on or make changes to this bug.