#4351 Builds fail on py2 builders
Closed: Fixed by mikem. Opened by mikem.

On python2, kojid can hit errors like this, near the end of an rpm build

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/koji/daemon.py", line 1433, in runTask
    response = (handler.run(),)
  File "/usr/lib/python2.7/site-packages/koji/tasks.py", line 355, in run
    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)
  File "/usr/lib/python2.7/site-packages/koji/util.py", line 516, in call_with_argcheck
    return func(*args, **kwargs)
  File "/usr/sbin/kojid", line 1723, in handler
    self.srpm_sanity_checks("%s/%s" % (resultdir, srpm_files[0]))
  File "/usr/sbin/kojid", line 1613, in srpm_sanity_checks
    h_fields = koji.get_header_fields(filename, ['packager', 'vendor', 'distribution'])
  File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1263, in get_header_fields
    ret[f] = get_header_field(hdr, f, src_arch=src_arch)
  File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1200, in get_header_field
    result = _get_header_field(hdr, name)
  File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1237, in _get_header_field
    return hdr[hdr_key]
IndexError: string index out of range

This bug is an unexpected side effect of #4214. It can cause string values from the configuration file to be unicode, not str. This includes topdir, so we wind up with unicode paths for many files. This confuses the logic in get_header_fields, which assumes non-str values are rpm headers.

Metadata Update from @mikem:
- Custom field Size adjusted to None

A related error can also happen in wrapperRPM

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/koji/daemon.py", line 1433, in runTask
    response = (handler.run(),)
  File "/usr/lib/python2.7/site-packages/koji/tasks.py", line 355, in run
    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)
  File "/usr/lib/python2.7/site-packages/koji/util.py", line 516, in call_with_argcheck
    return func(*args, **kwargs)
  File "/usr/sbin/kojid", line 2323, in handler
    searchList=[values]).respond()
  File "/usr/lib64/python2.7/site-packages/Cheetah/Template.py", line 1259, in __init__
    self._compile(source, file, compilerSettings=compilerSettings)
  File "/usr/lib64/python2.7/site-packages/Cheetah/Template.py", line 1553, in _compile
    keepRefToGeneratedCode=True)
  File "/usr/lib64/python2.7/site-packages/Cheetah/Template.py", line 637, in compile
    moduleName = convertTmplPathToModuleName(file)
  File "/usr/lib64/python2.7/site-packages/Cheetah/convertTmplPathToModuleName.py", line 20, in convertTmplPathToModuleName
    return splitdrive(tmplPath)[1].translate(_pathNameTransChars)
TypeError: character mapping must return integer, None or unicode

Perhaps the easiest thing to do here is to just revert the py2 case from #4214

Metadata Update from @mikem:
- Issue tagged with: testing-basic

Metadata Update from @mfilip:
- Issue tagged with: testing-done

Commit b6c9ce7a fixes this issue

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4351

Please continue any further discussion there.

Metadata
Related Pull Requests