From: Fabian Groffen Date: Mon, 30 Oct 2006 20:01:26 +0000 (-0000) Subject: Merged from trunk 4876:4881 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=faef2ebee14db256afe55b7eca7697aba5926054;p=portage.git Merged from trunk 4876:4881 For bug #153295, do a sanity check for non-string types in config.environ(). For getmaskingstatus messages, don't assume ARCH is a valid keyword, since that assumption is not necessarily correct for operating systems other than Linux. Thanks to Diego Petteno for reporting. Just use stat instead of lstat for config protect, so that broken symlinks are just ignored. svn path=/main/branches/prefix/; revision=4883 --- diff --git a/bin/dispatch-conf b/bin/dispatch-conf index fe524517d..29ecb89d4 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -80,7 +80,7 @@ class dispatch: for path in config_paths.split (): path = portage.normalize_path(portage_const.EPREFIX + path) try: - mymode = os.lstat(path).st_mode + mymode = os.stat(path).st_mode except OSError: continue basename = "*" diff --git a/pym/portage.py b/pym/portage.py index 99420474b..4cf304ea4 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1912,7 +1912,12 @@ class config: "return our locally-maintained environment" mydict={} for x in self.keys(): - mydict[x]=self[x] + myvalue = self[x] + if not isinstance(myvalue, basestring): + writemsg("!!! Non-string value in config: %s=%s\n" % \ + (x, myvalue), noiselevel=-1) + continue + mydict[x] = myvalue if not mydict.has_key("HOME") and mydict.has_key("BUILD_PREFIX"): writemsg("*** HOME not set. Setting to "+mydict["BUILD_PREFIX"]+"\n") mydict["HOME"]=mydict["BUILD_PREFIX"][:] @@ -3958,6 +3963,10 @@ def getmaskingstatus(mycpv, settings=None, portdb=None): mygroups = mygroups.split() pgroups = settings["ACCEPT_KEYWORDS"].split() myarch = settings["ARCH"] + if pgroups and myarch not in pgroups: + """For operating systems other than Linux, ARCH is not necessarily a + valid keyword.""" + myarch = pgroups[0].lstrip("~") pkgdict = settings.pkeywordsdict cp = dep_getkey(mycpv) diff --git a/pym/portage_util.py b/pym/portage_util.py index bfa0554e8..086f3b741 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -848,14 +848,9 @@ class ConfigProtect(object): os.path.join(self.myroot, x.lstrip(os.path.sep))) mystat = None try: - """Use lstat so that anything, even a broken symlink can be - protected.""" - if stat.S_ISDIR(os.lstat(ppath).st_mode): - self._dirs.add(ppath) - self.protect.append(ppath) - """Now use stat in case this is a symlink to a directory.""" if stat.S_ISDIR(os.stat(ppath).st_mode): self._dirs.add(ppath) + self.protect.append(ppath) except OSError: # If it doesn't exist, there's no need to protect it. pass