Bug 21392 - rpmvercmp ordering imperfect
rpmvercmp ordering imperfect
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2000-11-27 16:03 EST by Greg Hudson
Modified: 2007-04-18 12:30 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-11-27 16:03:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Greg Hudson 2000-11-27 16:03:18 EST
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 09:15:56 EST
Added to rpm CVS. Thanks for noticing.

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