File 0004-virtinst-python3-use-binary-mode-for-kernel.patch of Package virt-manager.9957

From 1e38d32429205ed8fbd088bcfe2dfea4229544b6 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 7 Dec 2017 12:42:45 +0100
Subject: [PATCH 4/4] virtinst: python3: use binary mode for kernel

This avoids the following error:

  File "/usr/share/virt-manager/virtinst/kernelupload.py", line 146, in upload_kernel_initrd
    kvol = _upload_file(conn, meter, pool, kernel)
  File "/usr/share/virt-manager/virtinst/kernelupload.py", line 105, in _upload_file
    data = fileobj.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 0xea in position 2: invalid continuation byte
---
 virtinst/kernelupload.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virtinst/kernelupload.py b/virtinst/kernelupload.py
index 80bb9c6d1143..5caeb51c4100 100644
--- a/virtinst/kernelupload.py
+++ b/virtinst/kernelupload.py
@@ -93,7 +93,7 @@ def _upload_file(conn, meter, destpool, src):
         vol.upload(stream, offset, length, flags)
 
         # Open source file
-        fileobj = open(src, "r")
+        fileobj = open(src, "rb")
 
         # Start transfer
         total = 0
-- 
2.15.1

openSUSE Build Service is sponsored by