RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1091708 - TypeError: getattr(): attribute name must be string
Summary: TypeError: getattr(): attribute name must be string
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: createrepo
Version: 7.0
Hardware: Unspecified
OS: Linux
urgent
urgent
Target Milestone: rc
: 7.3
Assignee: Valentina Mukhamedzhanova
QA Contact: Eva Mrakova
URL:
Whiteboard:
: 1219607 (view as bug list)
Depends On: 1058975
Blocks: 1154205 1178763 1274917
TreeView+ depends on / blocked
 
Reported: 2014-04-27 13:18 UTC by Dan Horák
Modified: 2015-12-09 12:38 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1058975
Environment:
Last Closed: 2015-12-09 12:38:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dan Horák 2014-04-27 13:18:00 UTC
+++ This bug was initially created as a clone of Bug #1058975 +++

Running a private koji instance with createrepo-0.10.1-0.fc21.noarch
It is failing during regen-repo

I see the following:

$ /usr/libexec/kojid/mergerepos -a ppc64le -b /mnt/koji/repos/f21-build/9/ppc64le/blocklist -o /mnt/koji/tmp/tasks/15/15/repo -g /mnt/koji/repos/f21-build/9/groups/comps.xml -r file:///mnt/koji/tmp/tasks/15/15/repo_9_premerge/ -r http://9.5.211.49/ppc64le-minimal-packages/
Adding repo: file:///mnt/koji/tmp/tasks/15/15/repo_9_premerge/
Adding repo: http://9.5.211.49/ppc64le-minimal-packages/
pkg = acl-2.2.52-4.fc21.ppc64le, type (pkg) = <class 'yum.sqlitesack.YumAvailablePackageSqlite'>
__getitem__: key = 0, type (key) = <type 'int'>
Traceback (most recent call last):
  File "/usr/libexec/kojid/mergerepos", line 262, in <module>
    main(sys.argv[1:])
  File "/usr/libexec/kojid/mergerepos", line 257, in main
    merge.write_metadata()
  File "/usr/libexec/kojid/mergerepos", line 237, in write_metadata
    mdgen.doPkgMetadata()
  File "/usr/lib/python2.7/site-packages/createrepo/__init__.py", line 406, in doPkgMetadata
    if '://' in pkg: # remote
  File "/usr/lib/python2.7/site-packages/yum/packages.py", line 384, in __getitem__
    return getattr(self, key)
TypeError: getattr(): attribute name must be string


It is from the following code:

[root@localhost ~]# cat /usr/lib/python2.7/site-packages/createrepo/__init__.py
...
            for pkg in self.conf.pkglist:
                self.callback.log("pkg = %s, type (pkg) = %s" % (pkg, type (pkg)))
                if "://" in pkg: # remote
...

[root@localhost ~]# cat /usr/lib/python2.7/site-packages/yum/packages.py
...
    def __getitem__(self, key):
        print "__getitem__: key = %s, type (key) = %s" % (key, type (key))
        return getattr(self, key)
...


It looks like Python is in a loop trying to enumerate the keys given that it has passed a 0 integer.

Is that code correct?  You are trying to use "in" for a substring test but relying on __getitem__ which is doing a member variable lookup.

http://docs.python.org/2/reference/datamodel.html#object.__contains__
http://docs.python.org/2/reference/expressions.html#membership-test-details

--- Additional comment from Zdeněk Pavlas on 2014-01-29 04:13:45 EST ---

Hi, thanks for the report!

"if '://' in pkg:" is correct under the normal use of the pkglist option, but I've missed that passing in a package sack was kind of supported too. (Although not documented, and --update didn't apparently work anyway).  Adding the early file checks broke this.  Fixed upstream.

http://createrepo.baseurl.org/gitweb?p=createrepo.git;a=commitdiff;h=b8904f59773a478aedd416963ec451c678a6bb72

Comment 1 Dan Horák 2014-04-27 13:19:21 UTC
The crash happens also with createrepo-0.9.9-23.el7.noarch, the upstream fix above resolves the problem also with 0.9.9

Comment 5 Karel Srot 2015-12-02 11:54:06 UTC
*** Bug 1219607 has been marked as a duplicate of this bug. ***


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