FIx the linebuffering for stdlib.call library
Closed this issue · 1 comments
pirat89 commented
Actual behavior
Currently we are not able to use linebuffering in stdlib.call
as we are not able to handle linebuffer correctly now. Sometimes it happens that the buffered string is broken because it
ends in the middle of utf8 character. We have a temporary solution now. For the correct solution, we should use codecs.StreamReader
.
Possible reproducer
It is possible it will not work for everyone and I am lazy to create short reproducer just now (sorry)
# LANG=cs_CZ.utf8
# leapp upgrade --debug
Err output
[root@localhost ~]# LEAPP_DEVEL_SKIP_RHSM=1 leapp upgrade
Process Process-61:
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 59, in _do_run
target_actor(logger=logger, messaging=messaging).run(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 299, in run
self.process(*args)
File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/rpmscanner/actor.py", line 26, in process
], split=True)['stdout']
File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/__init__.py", line 142, in run
result = _call(args, callback_raw=callback_raw)
File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/call.py", line 156, in _call
**extra
File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/call.py", line 46, in _multiplex
linebufs[fd] += read.decode(encoding)
File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc2 in position 79: unexpected end of data**Expected behavior**