From: Zac Medico Date: Sat, 18 Sep 2010 14:47:59 +0000 (-0700) Subject: Fix ebuild-ipc.py to timeout if necessary when opening input_file X-Git-Tag: v2.2_rc84~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=88b8b762722c1ec1ccc83d3f8a06e12fb5424139;p=portage.git Fix ebuild-ipc.py to timeout if necessary when opening input_file in blocking mode. --- diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py index 7637fb5d5..6f17f737b 100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@ -120,7 +120,7 @@ class EbuildIpc(object): self._no_daemon_msg() return 2 - input_file = open(self.ipc_out_fifo, 'rb', 0) + input_file = None start_time = time.time() while True: @@ -128,6 +128,10 @@ class EbuildIpc(object): try: portage.exception.AlarmSignal.register( self._COMMUNICATE_RETRY_TIMEOUT_SECONDS) + + if input_file is None: + input_file = open(self.ipc_out_fifo, 'rb', 0) + # Read the whole pickle in a single atomic read() call. buf = array.array('B') try: @@ -148,6 +152,9 @@ class EbuildIpc(object): self._no_daemon_msg() return 2 + if input_file is not None: + input_file.close() + rval = 2 if buf: @@ -161,7 +168,6 @@ class EbuildIpc(object): level=logging.ERROR, noiselevel=-1) else: - input_file.close() (out, err, rval) = reply