summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-23 00:07:08 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-23 00:07:08 -0700
commit0d7eb266a9d7909591817e4fd899c1c2ab07b53c (patch)
treec0376313b1869a3f00e3c3b68a3fa431dd1d0a6d /pym
parentb151fa14f49c2b5e4da7bdfdb5eaf29aaf985a7b (diff)
downloadportage-0d7eb266a9d7909591817e4fd899c1c2ab07b53c.tar.gz
portage-0d7eb266a9d7909591817e4fd899c1c2ab07b53c.tar.bz2
portage-0d7eb266a9d7909591817e4fd899c1c2ab07b53c.zip
Bug #337465 - Make EbuildIpcDaemon._input_handler() use os.read()
since array.fromfile() and file.read() are both known to erroneously return an empty string from this non-blocking fifo stream on FreeBSD.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/EbuildIpcDaemon.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py
index adca1b61e..d418fc80a 100644
--- a/pym/_emerge/EbuildIpcDaemon.py
+++ b/pym/_emerge/EbuildIpcDaemon.py
@@ -3,7 +3,9 @@
import errno
import pickle
+from portage import os
from _emerge.FifoIpcDaemon import FifoIpcDaemon
+from _emerge.PollConstants import PollConstants
class EbuildIpcDaemon(FifoIpcDaemon):
"""
@@ -28,12 +30,18 @@ class EbuildIpcDaemon(FifoIpcDaemon):
def _input_handler(self, fd, event):
# Read the whole pickle in a single atomic read() call.
- buf = self._read_buf(self._files.pipe_in, event)
+ data = None
+ if event & PollConstants.POLLIN:
+ # For maximum portability, use os.read() here since
+ # array.fromfile() and file.read() are both known to
+ # erroneously return an empty string from this
+ # non-blocking fifo stream on FreeBSD (bug #337465).
+ data = os.read(fd, self._bufsize)
- if buf:
+ if data:
try:
- obj = pickle.loads(buf.tostring())
+ obj = pickle.loads(data)
except SystemExit:
raise
except Exception: