From: Zac Medico Date: Sun, 14 Dec 2008 20:21:32 +0000 (-0000) Subject: Bug #250902 - Inside dblink._find_libs_to_preserve(), prevent symlinks from X-Git-Tag: v2.2_rc18~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=11cdf03af901801600ca50edcbe4de5eb6bbc560;p=portage.git Bug #250902 - Inside dblink._find_libs_to_preserve(), prevent symlinks from being erroneously preserved by themselves when the old instance installed symlinks that the new instance does not install. svn path=/main/trunk/; revision=12251 --- diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 4abc1e126..d992a3292 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2583,7 +2583,22 @@ class dblink(object): preserve_paths = set() for preserve_node in preserve_nodes: - preserve_paths.update(preserve_node.alt_paths) + # Make sure that at least one of the paths is not a symlink. + # This prevents symlinks from being erroneously preserved by + # themselves when the old instance installed symlinks that + # the new instance does not install. + have_lib = False + for f in preserve_node.alt_paths: + f_abs = os.path.join(root, f.lstrip(os.sep)) + try: + if stat.S_ISREG(os.lstat(f_abs).st_mode): + have_lib = True + break + except OSError: + continue + + if have_lib: + preserve_paths.update(preserve_node.alt_paths) return preserve_paths