Bug 539580

Summary: "package-cleanup --problems" fails with TypeError
Product: [Fedora] Fedora Reporter: Steve Snyder <swsnyder>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: eddie, ffesti, james.antill, knutjbj, maxamillion, ondrejj, pmatilai, shadwman, sinchenko, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-16 15:45:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Remove duplicate flags. none

Description Steve Snyder 2009-11-20 16:41:59 UTC
Description of problem:

See Summary

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

yum-utils-1.1.24-2.fc12.noarch

How reproducible:

Seen twice in 2 tries.

Steps to Reproduce:
1. On newly-installed F12 system, run as root: 
       /usr/bin/package-cleanup --problems
2.
3.
  
Actual results:

# /usr/bin/package-cleanup --problems
Loaded plugins: presto, refresh-packagekit
Traceback (most recent call last):
  File "/usr/bin/package-cleanup", line 382, in <module>
    util = PackageCleanup()
  File "/usr/bin/package-cleanup", line 58, in __init__
    self.main()
  File "/usr/bin/package-cleanup", line 309, in main
    issues = self._find_missing_deps(self.rpmdb.returnPackages())
  File "/usr/bin/package-cleanup", line 137, in _find_missing_deps
    missing = miscutils.formatRequire(req,ver,flags)
  File "/usr/lib/python2.6/site-packages/rpmUtils/miscutils.py", line 350, in formatRequire
    rpm.RPMSENSE_EQUAL):
TypeError: unsupported operand type(s) for &: 'str' and 'int'

Expected results:

No errors should occur.

Additional info:

Comment 1 Jan ONDREJ 2009-11-24 17:48:30 UTC
Same problem for me. This happens only if there are some versioning dependency problems, so if you want to reproduce, you have to make some.

It's easy to fix in this code:

/usr/lib/python2.6/site-packages/rpmUtils/miscutils.py:
def formatRequire (name, version, flags):
    s = name
    
    if flags:
        if flags & (rpm.RPMSENSE_LESS | rpm.RPMSENSE_GREATER |
                    rpm.RPMSENSE_EQUAL):
            s = s + " "
            if flags & rpm.RPMSENSE_LESS:
                s = s + "<"
            if flags & rpm.RPMSENSE_GREATER:
                s = s + ">"
            if flags & rpm.RPMSENSE_EQUAL:
                s = s + "="
            if version:
                s = "%s %s" %(s, version)
    return s

Why there is need to test "flags & ...", if all this code is inside "if flags:" block? Patch attached.

Also changing component to yum, because this file is a part of yum package.

Comment 2 Jan ONDREJ 2009-11-24 17:52:10 UTC
*** Bug 539335 has been marked as a duplicate of this bug. ***

Comment 3 Jan ONDREJ 2009-12-16 08:16:09 UTC
Created attachment 378708 [details]
Remove duplicate flags.

As described in previous comment, removal of duplicate flags helps.
Seth, please apply this.

Comment 4 James Antill 2009-12-16 15:45:15 UTC
Your patch always prints out "<>=" for the flags.

Anyway, this should be fixed upstream already ... just waiting on a new yum-utils release in F12.

*** This bug has been marked as a duplicate of bug 541551 ***