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

Torben Hohn torben.hohn at linutronix.de
Fri Jul 17 11:02:05 CEST 2020


On Thu, Jul 16, 2020 at 03:52:50PM -0400, Olivier Dion wrote:
> 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.

please print out data.
maybe its truncated somehow ?

does reducing the blocksize help somehow ?

Does this happen with the last block ?

please find out some more information on this.
also consider, that this might be a problem on your distro only.

I think, i have elbe-ci up and running again.
Trying to reproduce this now.


Anyways. You are supposed to implement tests.
The estimation did not include fixing things.



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

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner


More information about the elbe-devel mailing list