1 |
Author: genone |
2 |
Date: 2008-05-02 02:53:14 +0000 (Fri, 02 May 2008) |
3 |
New Revision: 10069 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
check if PORTAGE_TMPDIR is mounted readonly/noexec (bug #219957) |
9 |
|
10 |
Modified: main/trunk/pym/portage/__init__.py |
11 |
=================================================================== |
12 |
--- main/trunk/pym/portage/__init__.py 2008-05-02 02:28:20 UTC (rev 10068) |
13 |
+++ main/trunk/pym/portage/__init__.py 2008-05-02 02:53:14 UTC (rev 10069) |
14 |
@@ -4723,7 +4723,35 @@ |
15 |
writemsg("does not exist. Please create this directory or " + \ |
16 |
"correct your PORTAGE_TMPDIR setting.\n", noiselevel=-1) |
17 |
return 1 |
18 |
+ |
19 |
+ # as some people use a separate PORTAGE_TMPDIR mount |
20 |
+ # we prefer that as the checks below would otherwise be pointless |
21 |
+ # for those people. |
22 |
+ if os.path.exists(os.path.join(mysettings["PORTAGE_TMPDIR"], "portage")): |
23 |
+ checkdir = os.path.join(mysettings["PORTAGE_TMPDIR"], "portage") |
24 |
+ else: |
25 |
+ checkdir = mysettings["PORTAGE_TMPDIR"] |
26 |
|
27 |
+ if not os.access(checkdir, os.W_OK): |
28 |
+ writemsg("%s is not writable.\n" % checkdir + \ |
29 |
+ "Likely cause is that you've mounted it as readonly.\n" \ |
30 |
+ , noiselevel=-1) |
31 |
+ return 1 |
32 |
+ else: |
33 |
+ from tempfile import NamedTemporaryFile |
34 |
+ fd = NamedTemporaryFile(prefix="exectest-", dir=checkdir) |
35 |
+ os.chmod(fd.name, 0755) |
36 |
+ if not os.access(fd.name, os.X_OK): |
37 |
+ writemsg("Can not execute files in %s\n" % checkdir + \ |
38 |
+ "Likely cause is that you've mounted it with one of the\n" + \ |
39 |
+ "following mount options: 'noexec', 'user', 'users'\n\n" + \ |
40 |
+ "Please make sure that portage can execute files in this direxctory.\n" \ |
41 |
+ , noiselevel=-1) |
42 |
+ fd.close() |
43 |
+ return 1 |
44 |
+ fd.close() |
45 |
+ del checkdir |
46 |
+ |
47 |
if mydo == "unmerge": |
48 |
return unmerge(mysettings["CATEGORY"], |
49 |
mysettings["PF"], myroot, mysettings, vartree=vartree) |
50 |
|
51 |
-- |
52 |
gentoo-commits@l.g.o mailing list |