aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-10 14:49:47 -0800
committerZac Medico <zmedico@gentoo.org>2011-03-10 14:49:47 -0800
commit79589a4ab283e2cd76452141d0a004a1cb347f24 (patch)
tree4dba32896a7f7d0a0d9d855ee0372b6d93a576b0 /bin
parentAbstractPollTask: log exceptional events (diff)
downloadportage-79589a4ab283e2cd76452141d0a004a1cb347f24.tar.gz
portage-79589a4ab283e2cd76452141d0a004a1cb347f24.tar.bz2
portage-79589a4ab283e2cd76452141d0a004a1cb347f24.zip
ebuild-ipc: use plain file read instead of array
Array.fromfile() seems to be more error prone. For example, see bug 337465.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild-ipc.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py
index 45d71202e..d8e7e5512 100755
--- a/bin/ebuild-ipc.py
+++ b/bin/ebuild-ipc.py
@@ -1,11 +1,10 @@
#!/usr/bin/python
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# This is a helper which ebuild processes can use
# to communicate with portage's main python process.
-import array
import logging
import os
import pickle
@@ -141,13 +140,11 @@ class EbuildIpc(object):
# read and write of whole pickles.
input_file = open(self.ipc_out_fifo, 'rb', 0)
- # For maximum portability, us an array in order to force
- # a single atomic read of a whole pickle (bug #337465).
- buf = array.array('B')
-
+ # For maximum portability, use a single atomic read.
+ buf = None
try:
- buf.fromfile(input_file, self._BUFSIZE)
- except (EOFError, IOError) as e:
+ buf = input_file.read(self._BUFSIZE)
+ except IOError as e:
if not buf:
portage.util.writemsg_level(
"ebuild-ipc: %s\n" % (e,),
@@ -167,7 +164,7 @@ class EbuildIpc(object):
else:
try:
- reply = pickle.loads(buf.tostring())
+ reply = pickle.loads(buf)
except SystemExit:
raise
except Exception as e: