summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-08 22:31:23 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-08 22:31:23 +0000
commit9b89d3055a2087f9aed6aa7d356ab64ad80f5f4d (patch)
tree0991433da0743f27a6f73ba6a7ba0b2020843ed4
parent33df10ae25e700d22b6c994267c3e108cca37f2e (diff)
downloadportage-9b89d3055a2087f9aed6aa7d356ab64ad80f5f4d.tar.gz
portage-9b89d3055a2087f9aed6aa7d356ab64ad80f5f4d.tar.bz2
portage-9b89d3055a2087f9aed6aa7d356ab64ad80f5f4d.zip
Bug #162542 - When checking permissions inside CCACHE_DIR for compatibility
with FEATURES=userpriv, check the permissions on files inside the directory to decide whether to fix the permissions. svn path=/main/trunk/; revision=9759
-rw-r--r--pym/portage/__init__.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index b629ae128..dbe02fba4 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4240,12 +4240,34 @@ def prepare_build_dirs(myroot, mysettings, cleanup):
if droppriv:
st = os.stat(mydir)
if st.st_gid != portage_gid or \
- not stat.S_IMODE(st.st_mode) & dirmode:
+ not dirmode == (stat.S_IMODE(st.st_mode) & dirmode):
droppriv_fix = True
+ if not droppriv_fix:
+ # Check permissions of files in the directory.
+ for filename in os.listdir(mydir):
+ try:
+ subdir_st = os.lstat(
+ os.path.join(mydir, filename))
+ except OSError:
+ continue
+ if subdir_st.st_gid != portage_gid or \
+ ((stat.S_ISDIR(subdir_st.st_mode) and \
+ not dirmode == (stat.S_IMODE(subdir_st.st_mode) & dirmode)) or \
+ (not stat.S_ISDIR(subdir_st.st_mode) and \
+ not filemode == (stat.S_IMODE(subdir_st.st_mode) & filemode))):
+ droppriv_fix = True
+ break
+ if droppriv_fix:
+ writemsg(colorize("WARN", " * ") + \
+ "Adjusting permissions " + \
+ "for FEATURES=userpriv: '%s'\n" % mydir,
+ noiselevel=-1)
+ elif modified:
+ writemsg(colorize("WARN", " * ") + \
+ "Adjusting permissions " + \
+ "for FEATURES=%s: '%s'\n" % (myfeature, mydir),
+ noiselevel=-1)
if modified or kwargs["always_recurse"] or droppriv_fix:
- if modified:
- writemsg("Adjusting permissions recursively: '%s'\n" % mydir,
- noiselevel=-1)
def onerror(e):
raise # The feature is disabled if a single error
# occurs during permissions adjustment.