summaryrefslogtreecommitdiffstats
path: root/bin/ebuild-ipc.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-20 16:24:38 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-20 16:24:38 -0700
commit8ddff22917b89f4377eedb8065a7ee73e0561517 (patch)
treef9d52de9395ae81e237ac480ed85306eaff7cc4a /bin/ebuild-ipc.py
parentd54430b4c2d2191d051930925e6029ec22c19baf (diff)
downloadportage-8ddff22917b89f4377eedb8065a7ee73e0561517.tar.gz
portage-8ddff22917b89f4377eedb8065a7ee73e0561517.tar.bz2
portage-8ddff22917b89f4377eedb8065a7ee73e0561517.zip
If ebuild-ipc times out during read, check if the read buffer is
non-empty in order to try to avoid a possible race condition.
Diffstat (limited to 'bin/ebuild-ipc.py')
-rwxr-xr-xbin/ebuild-ipc.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py
index 6f17f737b..76e64329b 100755
--- a/bin/ebuild-ipc.py
+++ b/bin/ebuild-ipc.py
@@ -121,6 +121,7 @@ class EbuildIpc(object):
return 2
input_file = None
+ buf = array.array('B')
start_time = time.time()
while True:
@@ -133,7 +134,6 @@ class EbuildIpc(object):
input_file = open(self.ipc_out_fifo, 'rb', 0)
# Read the whole pickle in a single atomic read() call.
- buf = array.array('B')
try:
buf.fromfile(input_file, self._BUFSIZE)
except (EOFError, IOError) as e:
@@ -145,7 +145,9 @@ class EbuildIpc(object):
finally:
portage.exception.AlarmSignal.unregister()
except portage.exception.AlarmSignal:
- if self._daemon_is_alive():
+ if buf:
+ break
+ elif self._daemon_is_alive():
self._timeout_retry_msg(start_time,
portage.localization._('during read'))
else: