Bug 539580 - "package-cleanup --problems" fails with TypeError
Summary: "package-cleanup --problems" fails with TypeError
Keywords:
Status: CLOSED DUPLICATE of bug 541551
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 539335 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-11-20 16:41 UTC by Steve Snyder
Modified: 2014-01-21 23:12 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-12-16 15:45:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Remove duplicate flags. (847 bytes, patch)
2009-12-16 08:16 UTC, Jan ONDREJ
no flags Details | Diff

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 ***


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