oamg/leapp

snactor run fails when producing non utf-8 character

Opened this issue · 2 comments

Actual behavior
Snactor run fails when actor produce non UTF-8 character.

To Reproduce
Create new actor which uses external command (eg. printf) to create non UTF-8 characeter.

See error

2019-10-09 07:58:42.842 DEBUG    PID: 5218 leapp.actors.runner: External command has finished: ['/tmp/xcase.runpath.RPGkTxRo/xcase-relics/Err=plain,Out=noutf8,Es=zero,Dbg=yes/script.sh']
Process Process-3:
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 63, in _do_run
    target_actor(logger=logger, messaging=messaging, config_model=config_model).run(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 320, in run
    self.process(*args)
  File "/tmp/xcase.runpath.RPGkTxRo/xcase-relics/Err=plain,Out=noutf8,Es=zero,Dbg=yes/Run/actors/runner/actor.py", line 17, in process
    run(["/tmp/xcase.runpath.RPGkTxRo/xcase-relics/Err=plain,Out=noutf8,Es=zero,Dbg=yes/script.sh"])
  File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/__init__.py", line 177, in run
    result = _call(args, callback_raw=callback_raw, callback_linebuffered=callback_linebuffered, env=env)
  File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/call.py", line 180, in _call
    **extra
  File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/call.py", line 60, in _multiplex
    linebufs[fd] += decoders[fd].decode(read)
  File "/usr/lib64/python2.7/codecs.py", line 296, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 5: invalid start byte


=======================================================================================
Actor runner unexpectedly terminated with exit code: 1 - Please check the above details
=======================================================================================

Note: this is irrelevant to locale - it may be for example listing directories whose names contain utf-8 chars. Do you know if it also happening during leapp upgrade, or just snactor run?

It seems like it's only happening during snactor run, no error happend durnig leapp upgrade.