[elbe-devel] [PATCH] soapclient: fix cdrom upload

Olivier Dion dion at linutronix.de
Thu Jul 16 21:52:50 CEST 2020


On Thu, 16 Jul 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> The cdrom file is opened in text mode. That results in utf-8 errors.
>
> ------------------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/old/linutronix/elbe/elbe", line 62, in <module>
> cmdmod.run_command(sys.argv[2:])
> File "/home/old/linutronix/elbe/elbepack/commands/control.py", line 189, in run_command
> action.execute(control, opt, args[1:])
> File "/home/old/linutronix/elbe/elbepack/soapclient.py", line 651, in execute
> bindata = fp.read(size)
> File "/usr/lib/python3.8/codecs.py", line 322, in decode
> (result, consumed) = self._buffer_decode(data, self.errors, final)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 32849: invalid continuation byte
> elbe control set_cdrom Failed
> Giving up
> ------------------------------------------------------------------------------
>
> Open file in binary mode. In Python2 this does not change anything. But
> in python3 this will result in read() returning bytes. And it will not
> try to treat the file data as utf-8.

Like I remembered, this is not the end of the story with soap:
----------------------------------------------------------------------
Uploading CDROM. This might take a while
Server returned error:

Traceback (most recent call last):
  File "/var/cache/elbe/devel/elbepack/daemons/soap/faults.py", line
  150, in wrapped
      return func(self, arg1, arg2, arg3)
        File "/var/cache/elbe/devel/elbepack/daemons/soap/esoap.py",
  line 268, in append_cdrom
      fp.write(binascii.a2b_base64(data))
      Error: Incorrect padding

elbe control set_cdrom Failed
Giving up
----------------------------------------------------------------------

Now what I found weird is that encoding to base64 on the host is fine.
But decoding in the initvm results in a padding error.  There's a
problem in the communication somehow.

-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen


More information about the elbe-devel mailing list