diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-12-22 11:10:18 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-12-22 11:10:18 -0800 |
commit | a34586a73724d6075a556f82a05fc16893db31e0 (patch) | |
tree | a80f34dcab3ebf25fb2affc056a061736a0948ab | |
parent | c3a50a9a2c8116c95c8b2f89d570a89c299ddea3 (diff) | |
download | portage-a34586a73724d6075a556f82a05fc16893db31e0.tar.gz portage-a34586a73724d6075a556f82a05fc16893db31e0.tar.bz2 portage-a34586a73724d6075a556f82a05fc16893db31e0.zip |
fetch: don't apply permissions to symlinks
We don't want to modify anything outside of the primary DISTDIR,
and symlinks typically point to PORTAGE_RO_DISTDIRS. This will
fix bug #395705.
-rw-r--r-- | pym/portage/package/ebuild/fetch.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py index 70743bfb2..c67f3c4f4 100644 --- a/pym/portage/package/ebuild/fetch.py +++ b/pym/portage/package/ebuild/fetch.py @@ -633,7 +633,10 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, match, mystat = _check_distfile( myfile_path, pruned_digests, eout) if match: - if distdir_writable: + # Skip permission adjustment for symlinks, since we don't + # want to modify anything outside of the primary DISTDIR, + # and symlinks typically point to PORTAGE_RO_DISTDIRS. + if distdir_writable and not os.path.islink(myfile_path): try: apply_secpass_permissions(myfile_path, gid=portage_gid, mode=0o664, mask=0o2, @@ -747,14 +750,18 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, raise del e else: - try: - apply_secpass_permissions( - myfile_path, gid=portage_gid, mode=0o664, mask=0o2, - stat_cached=mystat) - except PortageException as e: - if not os.access(myfile_path, os.R_OK): - writemsg(_("!!! Failed to adjust permissions:" - " %s\n") % str(e), noiselevel=-1) + # Skip permission adjustment for symlinks, since we don't + # want to modify anything outside of the primary DISTDIR, + # and symlinks typically point to PORTAGE_RO_DISTDIRS. + if not os.path.islink(myfile_path): + try: + apply_secpass_permissions(myfile_path, + gid=portage_gid, mode=0o664, mask=0o2, + stat_cached=mystat) + except PortageException as e: + if not os.access(myfile_path, os.R_OK): + writemsg(_("!!! Failed to adjust permissions:" + " %s\n") % (e,), noiselevel=-1) # If the file is empty then it's obviously invalid. Remove # the empty file and try to download if possible. |