Bug 113668 - rpmvercmp not returning correctly on ppc
Summary: rpmvercmp not returning correctly on ppc
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 1.0
Hardware: powerpc Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-16 10:16 UTC by Paul Nasrat
Modified: 2007-04-18 17:01 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Paul Nasrat 2004-01-16 10:16:24 UTC
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 15:32:13 UTC
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 14:25:40 UTC
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 18:54:08 UTC
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.