#1312 non-fast uploads fail under python3
Closed: Fixed 3 months ago by mikem. Opened 3 months ago by mikem.

The older upload mechanism fails

Uploading srpm: /home/mike/Devel/fake/fake-1.1-27.src.rpm
Traceback (most recent call last):   ]  00% 00:00:00     0.00 B        - B/sec
  File "/home/mike/Devel/koji/koji/cli2/lkoji", line 310, in <module>
    rv = locals()[command].__call__(options, session, args)
  File "/home/mike/Devel/koji/koji/cli/koji_cli/commands.py", line 494, in handle_build
    session.uploadWrapper(source, serverdir, callback=callback)
  File "/home/mike/Devel/koji/koji/koji/__init__.py", line 2776, in uploadWrapper
    contents = fo.read(blocksize)
  File "/usr/lib64/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte

Granted, this is a rare case. It's not enough to simply set use_fast_upload=no as the cli will still use it if the server appears to supports it. However, uploading to an old enough server could trigger this bug.


By itself, I won't consider this a release blocker at this point, given the rarity of the situation (fast upload was added in 1.7.1), but since there are a number of other base64-related bugs, might as well fix this one too.

There is a hub side to this too:

Traceback (most recent call last):
  File "/usr/share/koji-hub/kojixmlrpc.py", line 235, in _wrap_handler
    response = handler(environ)
  File "/usr/share/koji-hub/kojixmlrpc.py", line 278, in handle_rpc
    return self._dispatch(method, params)
  File "/usr/share/koji-hub/kojixmlrpc.py", line 315, in _dispatch
    ret = koji.util.call_with_argcheck(func, params, opts)
  File "/usr/lib/python3.6/site-packages/koji/util.py", line 226, in call_with_argcheck
    return func(*args, **kwargs)
  File "/usr/share/koji-hub/kojihub.py", line 9062, in uploadFile
    contents = base64.decodestring(data)
  File "/usr/lib64/python3.6/base64.py", line 554, in decodestring
    return decodebytes(s)
  File "/usr/lib64/python3.6/base64.py", line 545, in decodebytes
    _input_type_check(s)
  File "/usr/lib64/python3.6/base64.py", line 513, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str

Metadata Update from @mikem:
- Issue set to the milestone: 1.17

3 months ago

Login to comment on this ticket.

Metadata