summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-13 19:47:27 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-13 19:56:45 -0800
commit64247b288f3fb2e4cfb72e545ffc230e8a05dd74 (patch)
tree93d5cee0eb3c8b41acc08aaa885d4d97ea5df1b6
parentb53e0000cbe1f4b5600d29224fb724b00e22088b (diff)
downloadportage-64247b288f3fb2e4cfb72e545ffc230e8a05dd74.tar.gz
portage-64247b288f3fb2e4cfb72e545ffc230e8a05dd74.tar.bz2
portage-64247b288f3fb2e4cfb72e545ffc230e8a05dd74.zip
apply_recursive_permissions: don't follow symlink
This will fix the following error, reported in bug #339670: _ebuild_exit _post_phase_userpriv_perms(settings) File "/usr/lib64/portage/pym/portage/package/ebuild/doebuild.py", line 1207, in _post_phase_userpriv_perms filemode=0o60, filemask=0) File "/usr/lib64/portage/pym/portage/util/__init__.py", line 1018, in apply_recursive_permissions uid=uid, gid=gid, mode=filemode, mask=filemask) File "/usr/lib64/portage/pym/portage/util/__init__.py", line 1043, in apply_secpass_permissions stat_cached = os.stat(filename) File "/usr/lib64/portage/pym/portage/__init__.py", line 226, in __call__ rval = self._func(*wrapped_args, **wrapped_kwargs) OSError: [Errno 40] Too many levels of symbolic links: '/var/tmp/portage/dev-vcs/mercurial-1.7.2/temp/tests-2.7/child0/test-mq-symlinks.t/linka'
-rw-r--r--pym/portage/util/__init__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 24beb2ef7..55ffcfc8a 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -954,6 +954,9 @@ def apply_recursive_permissions(top, uid=-1, gid=-1,
Returns True if all permissions are applied and False if some are left
unapplied."""
+ # Avoid issues with circular symbolic links, as in bug #339670.
+ follow_links = False
+
if onerror is None:
# Default behavior is to dump errors to stderr so they won't
# go unnoticed. Callers can pass in a quiet instance.
@@ -970,7 +973,8 @@ def apply_recursive_permissions(top, uid=-1, gid=-1,
for dirpath, dirnames, filenames in os.walk(top):
try:
applied = apply_secpass_permissions(dirpath,
- uid=uid, gid=gid, mode=dirmode, mask=dirmask)
+ uid=uid, gid=gid, mode=dirmode, mask=dirmask,
+ follow_links=follow_links)
if not applied:
all_applied = False
except PortageException as e:
@@ -980,7 +984,8 @@ def apply_recursive_permissions(top, uid=-1, gid=-1,
for name in filenames:
try:
applied = apply_secpass_permissions(os.path.join(dirpath, name),
- uid=uid, gid=gid, mode=filemode, mask=filemask)
+ uid=uid, gid=gid, mode=filemode, mask=filemask,
+ follow_links=follow_links)
if not applied:
all_applied = False
except PortageException as e: