Fix crit errors

This commit is contained in:
lingsheng 2020-09-22 15:19:06 +08:00
parent 842e28e6c7
commit e1971480eb
4 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From d1c7216c4265c45bcb8b9380b8ad4e5ed69d014e Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Tue, 22 Sep 2020 14:36:55 +0800
Subject: [PATCH 1/3] Fix crit encode TypeError
---
lib/py/cli.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/py/cli.py b/lib/py/cli.py
index da34302..966dd4e 100755
--- a/lib/py/cli.py
+++ b/lib/py/cli.py
@@ -16,7 +16,10 @@ def inf(opts):
def outf(opts):
if opts['out']:
- return open(opts['out'], 'w+')
+ if getattr(opts['func'], '__name__') == 'encode':
+ return open(opts['out'], 'wb+')
+ else:
+ return open(opts['out'], 'w+')
else:
return sys.stdout
--
2.23.0

View File

@ -0,0 +1,25 @@
From a1d4d678de01b0569e8d36894a8d60a8b75bb016 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Tue, 22 Sep 2020 14:39:22 +0800
Subject: [PATCH 2/3] Fix crit info struct unpack error
---
lib/py/images/images.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/py/images/images.py b/lib/py/images/images.py
index f4517d8..72205fe 100644
--- a/lib/py/images/images.py
+++ b/lib/py/images/images.py
@@ -171,7 +171,7 @@ class entry_handler:
while True:
buf = f.read(4)
- if buf == '':
+ if len(buf) == 0:
break
size, = struct.unpack('i', buf)
f.seek(size, 1)
--
2.23.0

View File

@ -0,0 +1,25 @@
From b2eea766a1f41553b76fef8d669e288ff552d0ed Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Tue, 22 Sep 2020 14:40:35 +0800
Subject: [PATCH 3/3] Fix crit x UnicodeDecodeError
---
lib/py/cli.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/py/cli.py b/lib/py/cli.py
index 966dd4e..f7bda23 100755
--- a/lib/py/cli.py
+++ b/lib/py/cli.py
@@ -25,7 +25,7 @@ def outf(opts):
def dinf(opts, name):
- return open(os.path.join(opts['dir'], name))
+ return open(os.path.join(opts['dir'], name), 'rb')
def decode(opts):
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: criu
Version: 3.13
Release: 6
Release: 7
Provides: crtools = %{version}-%{release}
Obsoletes: crtools <= 1.0-2
Summary: A tool of Checkpoint/Restore in User-space
@ -15,6 +15,10 @@ Requires: %{name} = %{version}-%{release}
Provides: %{name}-libs = %{version}-%{release}
Obsoletes: %{name}-libs < %{version}-%{release}
Patch0001: 0001-Fix-crit-encode-TypeError.patch
Patch0002: 0002-Fix-crit-info-struct-unpack-error.patch
Patch0003: 0003-Fix-crit-x-UnicodeDecodeError.patch
%description
Checkpoint/Restore in Userspace(CRIU),is a software tool for the linux operating system.
Using this tool,it is possible to freeze a running application (or part of it) and
@ -87,5 +91,8 @@ chmod 0755 %{buildroot}/run/%{name}/
%doc %{_mandir}/man1/{compel.1*,crit.1*}
%changelog
* Tue Sep 22 2020 lingsheng <lingsheng@huawei.com> - 3.13-7
- Fix crit errors
* Fri Apr 24 2020 wutao <wutao61@huawei.com> - 3.13-6
- Package init