summaryrefslogtreecommitdiffstats
path: root/pym/portage_util.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-17 21:10:15 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-17 21:10:15 +0000
commit556c2b1a88e0e47421f1f4b6826ecac372913ad2 (patch)
treea27faa26fe25570a4785bd3459ff549989c08e57 /pym/portage_util.py
parentff68c0393a328a04bff228d1e2a5aef7d2d21bbf (diff)
downloadportage-556c2b1a88e0e47421f1f4b6826ecac372913ad2.tar.gz
portage-556c2b1a88e0e47421f1f4b6826ecac372913ad2.tar.bz2
portage-556c2b1a88e0e47421f1f4b6826ecac372913ad2.zip
Fix CONFIG_PROTECT so that is works with symlinked directories for bug #151502.
svn path=/main/trunk/; revision=4742
Diffstat (limited to 'pym/portage_util.py')
-rw-r--r--pym/portage_util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py
index d07fe63c9..0e6d53956 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -848,9 +848,14 @@ 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)
except OSError:
# If it doesn't exist, there's no need to protect it.
pass
@@ -861,9 +866,14 @@ 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.protectmask.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)
except OSError:
# If it doesn't exist, there's no need to mask it.
pass