Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/
Date: Thu, 22 Dec 2011 19:10:43
Message-Id: a34586a73724d6075a556f82a05fc16893db31e0.zmedico@gentoo
1 commit: a34586a73724d6075a556f82a05fc16893db31e0
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 22 19:10:18 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 22 19:10:18 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a34586a7
7
8 fetch: don't apply permissions to symlinks
9
10 We don't want to modify anything outside of the primary DISTDIR,
11 and symlinks typically point to PORTAGE_RO_DISTDIRS. This will
12 fix bug #395705.
13
14 ---
15 pym/portage/package/ebuild/fetch.py | 25 ++++++++++++++++---------
16 1 files changed, 16 insertions(+), 9 deletions(-)
17
18 diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
19 index 70743bf..c67f3c4 100644
20 --- a/pym/portage/package/ebuild/fetch.py
21 +++ b/pym/portage/package/ebuild/fetch.py
22 @@ -633,7 +633,10 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
23 match, mystat = _check_distfile(
24 myfile_path, pruned_digests, eout)
25 if match:
26 - if distdir_writable:
27 + # Skip permission adjustment for symlinks, since we don't
28 + # want to modify anything outside of the primary DISTDIR,
29 + # and symlinks typically point to PORTAGE_RO_DISTDIRS.
30 + if distdir_writable and not os.path.islink(myfile_path):
31 try:
32 apply_secpass_permissions(myfile_path,
33 gid=portage_gid, mode=0o664, mask=0o2,
34 @@ -747,14 +750,18 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
35 raise
36 del e
37 else:
38 - try:
39 - apply_secpass_permissions(
40 - myfile_path, gid=portage_gid, mode=0o664, mask=0o2,
41 - stat_cached=mystat)
42 - except PortageException as e:
43 - if not os.access(myfile_path, os.R_OK):
44 - writemsg(_("!!! Failed to adjust permissions:"
45 - " %s\n") % str(e), noiselevel=-1)
46 + # Skip permission adjustment for symlinks, since we don't
47 + # want to modify anything outside of the primary DISTDIR,
48 + # and symlinks typically point to PORTAGE_RO_DISTDIRS.
49 + if not os.path.islink(myfile_path):
50 + try:
51 + apply_secpass_permissions(myfile_path,
52 + gid=portage_gid, mode=0o664, mask=0o2,
53 + stat_cached=mystat)
54 + except PortageException as e:
55 + if not os.access(myfile_path, os.R_OK):
56 + writemsg(_("!!! Failed to adjust permissions:"
57 + " %s\n") % (e,), noiselevel=-1)
58
59 # If the file is empty then it's obviously invalid. Remove
60 # the empty file and try to download if possible.