Bug 113668 - rpmvercmp not returning correctly on ppc
rpmvercmp not returning correctly on ppc
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: rpm (Show other bugs)
1.0
powerpc Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-16 05:16 EST by Paul Nasrat
Modified: 2007-04-18 13:01 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-02-23 13:54:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Paul Nasrat 2004-01-16 05:16:24 EST
Description of problem:

Whilst testing out rpm.labelCompare I noticed I was getting values
other than 1,-1,0.  Tested on my x86 rawhide box and acted as expected.

Version-Release number of selected component (if applicable):

rpm-4.3-0.7

How reproducible:

Always

Steps to Reproduce:
1. I wrote a small c program

#include <stdio.h>
#include <rpm/rpmlib.h>
 
 
int main() {
        int rc;
        rc = rpmvercmp("1", "2");
        printf("%d\n", rc);
        return rc;
 }

2. compile 
3. run
  
Actual results:
[pauln@imac tmp]$ ./testrpmcmp
-16782168


Expected results:

-1

Additional info:

[pauln@imac tmp]$ rpm -q rpm
rpm-4.3-0.7
[pauln@imac tmp]$ uname -a
Linux imac.eridu 2.4.22-2f #1 Sun Nov 9 16:49:49 EST 2003 ppc ppc ppc
GNU/Linux

Same occurs obviously using python:

>>> rpm.labelCompare(('1', '1','2'), ('1', '1', '3'))
-16777120

This is a ydl 3 -> rawhide machine I haven't been able to get
confirmation.
Comment 1 Jeff Johnson 2004-01-16 10:32:13 EST
Test program returns -1 on i686.

I suspect strcmp guarantees only sign, not value, for compare.

NEEDINFO so's I don't have to stare at this bug.
Comment 2 Paul Nasrat 2004-02-17 09:25:40 EST
man 3 strcmp confirms that assertion

patch checked in on HEAD after testing on ppc chroot

>>> rpm.labelCompare(('1', '1','2'), ('1', '1', '3'))
-1
>>> rpm.labelCompare(('1', '1','2'), ('1', '1', '1'))
1
>>> rpm.labelCompare(('1', '1','1'), ('1', '1', '1'))
0
Comment 3 Jeff Johnson 2004-02-23 13:54:08 EST
Added to rpm-4_3 and rpm-4_2 branches.

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