1 |
commit: 89de8064e8d186a7a001dd1f2f5c486c64f4104f |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 31 05:23:29 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 31 05:25:06 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=89de8064 |
7 |
|
8 |
locks: chown lockfiles only if permitted (bug 674090) |
9 |
|
10 |
Reported-by: Jeroen Roovers <jer <AT> gentoo.org> |
11 |
Bug: https://bugs.gentoo.org/674090 |
12 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
13 |
|
14 |
lib/portage/locks.py | 4 ++-- |
15 |
1 file changed, 2 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/lib/portage/locks.py b/lib/portage/locks.py |
18 |
index f61e1819a..a4e7ec53f 100644 |
19 |
--- a/lib/portage/locks.py |
20 |
+++ b/lib/portage/locks.py |
21 |
@@ -163,7 +163,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, |
22 |
|
23 |
if not preexisting: |
24 |
try: |
25 |
- if os.stat(lockfilename).st_gid != portage_gid: |
26 |
+ if portage.data.secpass >= 1 and os.stat(lockfilename).st_gid != portage_gid: |
27 |
os.chown(lockfilename, -1, portage_gid) |
28 |
except OSError as e: |
29 |
if e.errno in (errno.ENOENT, errno.ESTALE): |
30 |
@@ -463,7 +463,7 @@ def hardlink_lockfile(lockfilename, max_wait=DeprecationWarning, |
31 |
if not preexisting: |
32 |
# Don't chown the file if it is preexisting, since we |
33 |
# want to preserve existing permissions in that case. |
34 |
- if myfd_st.st_gid != portage_gid: |
35 |
+ if portage.data.secpass >= 1 and myfd_st.st_gid != portage_gid: |
36 |
os.fchown(myfd, -1, portage_gid) |
37 |
except OSError as e: |
38 |
if e.errno not in (errno.ENOENT, errno.ESTALE): |