66b169ccf2
Resolves #1246459 Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 8f26482402179dc64b9488be05ef9686922446ec Mon Sep 17 00:00:00 2001
|
|
From: Jakub Filak <jfilak@redhat.com>
|
|
Date: Fri, 24 Jul 2015 13:50:00 +0200
|
|
Subject: [PATCH] vmcore: read vmcore by chunks
|
|
|
|
Reading vmcore by lines was not a good idea and the switch to Python 3
|
|
makes it impossible because of the binary format of that file (the file
|
|
does not contain only valid Unicode strings and that raises
|
|
UnicodeDecodeError from the for statement).
|
|
|
|
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
---
|
|
src/hooks/abrt_harvest_vmcore.py.in | 9 ++++++---
|
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
|
|
index c5e7d53..61a6e57 100644
|
|
--- a/src/hooks/abrt_harvest_vmcore.py.in
|
|
+++ b/src/hooks/abrt_harvest_vmcore.py.in
|
|
@@ -214,9 +214,12 @@ def harvest_vmcore():
|
|
hashobj = hashlib.sha1()
|
|
# Iterate over the file a line at a time in order to not load the whole
|
|
# vmcore file
|
|
- with open(os.path.join(f_full, 'vmcore'), 'r') as corefile:
|
|
- for line in corefile:
|
|
- hashobj.update(line)
|
|
+ with open(os.path.join(f_full, 'vmcore'), 'rb') as corefile:
|
|
+ while True:
|
|
+ chunk = corefile.read(8192)
|
|
+ if not chunk:
|
|
+ break
|
|
+ hashobj.update(chunk)
|
|
|
|
dd = create_abrtd_info(destdirnew, hashobj.hexdigest())
|
|
if dd is None:
|
|
--
|
|
2.4.6
|
|
|