From 690312722e111cf813b591dd4dccb4400f5f7f79 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 25 Oct 2012 12:48:56 -0700 Subject: merge-sync: handle unmerge corner cases In dblink_merged_path we need to distinguish between existing and non-existing, since we need an existing path of syncfs. --- pym/portage/dbapi/vartree.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'pym/portage/dbapi') diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 5bcd07797..aae23e6ba 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2156,7 +2156,7 @@ class dblink(object): # here so that _unmerge_dirs can see that we've # removed a file from this device, and will record # the parent directory for a syncfs call. - self._merged_path(file_name, lstatobj) + self._merged_path(file_name, lstatobj, exists=False) finally: if bsd_chflags and pflags != 0: @@ -4706,10 +4706,17 @@ class dblink(object): outfile.write("dev %s\n" % myrealdest) showMessage(zing + " " + mydest + "\n") - def _merged_path(self, path, lstatobj): + def _merged_path(self, path, lstatobj, exists=True): previous_path = self._device_path_map.get(lstatobj.st_dev) - if previous_path is None or len(path) < len(previous_path): - self._device_path_map[lstatobj.st_dev] = path + if previous_path is None or previous_path is False or \ + (exists and len(path) < len(previous_path)): + if exists: + self._device_path_map[lstatobj.st_dev] = path + else: + # This entry is used to indicate that we've unmerged + # a file from this device, and later, this entry is + # replaced by a parent directory. + self._device_path_map[lstatobj.st_dev] = False def _post_merge_sync(self): """ @@ -4731,6 +4738,8 @@ class dblink(object): proc.wait() else: for path in self._device_path_map.values(): + if path is False: + continue try: fd = os.open(path, os.O_RDONLY) except OSError: -- cgit v1.2.3-1-g7c22