From 1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 10 Sep 2010 00:14:03 -0700 Subject: [PATCH] Make ebuild-ipc.py handle exceptions from pickle.loads(). --- bin/ebuild-ipc.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py index 5569a24b5..21e5647f3 100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@ -94,23 +94,27 @@ class EbuildIpc(object): except IOError as e: portage.util.writemsg("%s\n" % (e,), noiselevel=-1) - if buf: + rval = 2 - reply = pickle.loads(buf.tostring()) - output_file.close() - input_file.close() + if buf: - (out, err, rval) = reply + try: + reply = pickle.loads(buf.tostring()) + except (EnvironmentError, EOFError, ValueError, + pickle.UnpicklingError) as e: + portage.util.writemsg("%s\n" % (e,), noiselevel=-1) - if out: - portage.util.writemsg_stdout(out, noiselevel=-1) + else: + output_file.close() + input_file.close() - if err: - portage.util.writemsg(err, noiselevel=-1) + (out, err, rval) = reply - else: + if out: + portage.util.writemsg_stdout(out, noiselevel=-1) - rval = 2 + if err: + portage.util.writemsg(err, noiselevel=-1) return rval -- 2.26.2