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