Bug 1264463

Summary: upstream test 257 failing on big endian systems
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: rpmAssignee: Florian Festi <ffesti>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: low Docs Contact:
Priority: medium    
Version: 7.1CC: jorton
Target Milestone: rc   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: rpm-4.11.3-18.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 04:37:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1289025, 1299750, 1313485    

Description Karel Srot 2015-09-18 14:01:55 UTC
Description of problem:

Upstream test 257 is failing on big endian systems pointing at a bug in rpm python binding

257. rpmpython.at:35: testing basic rpmio ...
./rpmpython.at:35:
cat << EOF > test.py
import rpm, sys
dbpath=rpm.expandMacro('%_dbpath')
rpm.addMacro('_dbpath', '${abs_builddir}/testing%s' % dbpath)
def myprint(msg = ''):
    sys.stdout.write('%s\n' % msg)

msg = 'Killroy was here\n'
data = msg * 10
# TODO: test other compression types too if built in
for iot in [ 'fpio', 'fdio', 'ufdio', 'gzdio' ]:
    fn = 'pyio.%s' % iot
    fd = rpm.fd(fn, 'w', iot)
    pos = fd.tell()
    if pos != -2 and pos != 0:
        myprint('bad start pos %d' % fd.tell())
    if fd.write(data) != len(data):
        myprint('%s write fail' % iot)
    if fn != fd.name:
        myprint('bad file name %s' % fd.name)
    fd.flush()
    pos = fd.tell()
    if pos != -2 and pos != len(data):
        myprint('bad end pos %d' % fd.tell())
    fd = rpm.fd(fn, 'r', iot)
    rdata = fd.read()
    if rdata != data:
        myprint('%s read fail (got %d bytes)' % (iot, len(rdata), rdata))
    # compressed io types can't seek
    if iot == 'ufdio':
        fd.seek(0)
    else:
        fd = rpm.fd(fn, 'r', iot)
    if fn != fd.name:
        myprint('bad file name %s' % fd.name)
    rdata = fd.read(len(msg))
    if rdata != msg:
        myprint('%s sized read fail (got %d bytes)\n%s' % (iot, len(rdata),
        rdata))

EOF
python test.py

--- /dev/null       2015-09-17 10:50:59.249741088 +0800
+++ /root/rpmbuild/BUILD/rpm-4.11.3/tests/rpmtests.dir/at-groups/257/stderr
    2015-09-17 19:17:24.384550983 +0800
@@ -0,0 +1,4 @@
+Traceback (most recent call last):
+  File "test.py", line 27, in <module>
+    myprint('%s read fail (got %d bytes)' % (iot, len(rdata), rdata))
+TypeError: not all arguments converted during string formatting
--- /dev/null       2015-09-17 10:50:59.249741088 +0800
+++ /root/rpmbuild/BUILD/rpm-4.11.3/tests/rpmtests.dir/at-groups/257/stdout
    2015-09-17 19:17:24.384550983 +0800
@@ -0,0 +1,2 @@
+fpio write fail
+bad end pos 6750208
./rpmpython.at:35: exit code was 1, expected 0
257. rpmpython.at:35: 257. basic rpmio (rpmpython.at:35): FAILED
(rpmpython.at:35)

Comment 2 Florian Festi 2015-09-22 11:05:30 UTC
While there obviously is a bug in rpm there also is one in the test case:

+Traceback (most recent call last):
+  File "test.py", line 27, in <module>
+    myprint('%s read fail (got %d bytes)' % (iot, len(rdata), rdata))
+TypeError: not all arguments converted during string formatting

You are missing another % in the message to render rdata.

Comment 3 Florian Festi 2015-09-22 11:22:05 UTC
*Eeek* Of course it is the rpm test case that is broken in addition to the problem of the Python binding.

Comment 5 Ľuboš Kardoš 2016-06-28 13:28:28 UTC
Fixed in version rpm-4.11.3-18

Comment 12 errata-xmlrpc 2016-11-04 04:37:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2359.html