[elbe-devel] [PATCH] Work around a pyme.core.Data init bug
bage at linutronix.de
bage at linutronix.de
Fri Mar 15 14:57:46 CET 2019
From: Bastian Germann <bage at linutronix.de>
pyme, which is used in Debian jessie (initvm) has a long standing bug which is
documented at https://sourceforge.net/p/pyme/bugs/9/
Unfortunately this was never fixed in Debian, so work around the bug by not
using the pyme.core.Data(file=filedescriptor) constructor.
pyme.core.Data(file=filename) is fine.
Signed-off-by: Bastian Germann <bage at linutronix.de>
---
elbepack/egpg.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/elbepack/egpg.py b/elbepack/egpg.py
index 019cdefa..40e0b64f 100644
--- a/elbepack/egpg.py
+++ b/elbepack/egpg.py
@@ -177,9 +177,7 @@ def sign_file(fname, fingerprint):
outfilename = fname + '.gpg'
try:
- with open(fname, 'r') as infile:
- with open(outfilename, 'w') as outfile:
- sign(infile, outfile, fingerprint)
+ sign(fname, outfilename, fingerprint)
except Exception as ex:
print("Error signing file %s" % ex.message)
@@ -210,7 +208,11 @@ def export_key(fingerprint, outfile):
ctx.set_armor(True)
try:
- ctx.op_export(fingerprint, 0, outfile)
+ outdata = core.Data()
+ ctx.op_export(fingerprint, 0, outdata)
+ outdata.seek(0, os.SEEK_SET)
+ key = outdata.read()
+ outfile.write(key)
except Exception:
print("Error exporting key %s" % (fingerprint))
--
2.11.0
More information about the elbe-devel
mailing list