From 9f65889534279731f4b00af243c1edc885eece09 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 26 Dec 2012 19:10:16 -0800 Subject: merge-sync: handle PyPy syncfs fail, bug #446610 --- pym/portage/dbapi/vartree.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'pym/portage/dbapi') diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 25128bf32..840e796f1 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -4731,15 +4731,10 @@ class dblink(object): "merge-sync" not in self.settings.features: return + syncfs_failed = False syncfs = _get_syncfs() - if syncfs is None: - try: - proc = subprocess.Popen(["sync"]) - except EnvironmentError: - pass - else: - proc.wait() - else: + + if syncfs is not None: for path in self._device_path_map.values(): if path is False: continue @@ -4749,12 +4744,22 @@ class dblink(object): pass else: try: - syncfs(fd) + if syncfs(fd) != 0: + # Happens with PyPy (bug #446610) + syncfs_failed = True except OSError: pass finally: os.close(fd) + if syncfs is None or syncfs_failed: + try: + proc = subprocess.Popen(["sync"]) + except EnvironmentError: + pass + else: + proc.wait() + def merge(self, mergeroot, inforoot, myroot=None, myebuild=None, cleanup=0, mydbapi=None, prev_mtimes=None, counter=None): """ -- cgit v1.2.3-1-g7c22