From: Zac Medico Date: Fri, 10 Sep 2010 07:14:03 +0000 (-0700) Subject: Make ebuild-ipc.py handle exceptions from pickle.loads(). X-Git-Tag: v2.2_rc79~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9;p=portage.git Make ebuild-ipc.py handle exceptions from pickle.loads(). --- 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