diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-02 03:33:09 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-02 03:33:09 +0000 |
commit | df4474c3fa92be3b9cb2a1caaaef5732ce41210f (patch) | |
tree | 297dd68eb8bbb614db284554c50d59bf134dfb4e | |
parent | 28e90fa805ba9472131817eec2e2c50b834d0fce (diff) | |
download | portage-df4474c3fa92be3b9cb2a1caaaef5732ce41210f.tar.gz portage-df4474c3fa92be3b9cb2a1caaaef5732ce41210f.tar.bz2 portage-df4474c3fa92be3b9cb2a1caaaef5732ce41210f.zip |
check if PORTAGE_TMPDIR is mounted readonly/noexec (bug #219957)
(trunk r10069)
svn path=/main/branches/2.1.2/; revision=10076
-rw-r--r-- | pym/portage.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 34bb0a4a1..d7f4bbbd5 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -4725,6 +4725,34 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, writemsg("does not exist. Please create this directory or " + \ "correct your PORTAGE_TMPDIR setting.\n", noiselevel=-1) return 1 + + # as some people use a separate PORTAGE_TMPDIR mount + # we prefer that as the checks below would otherwise be pointless + # for those people. + if os.path.exists(os.path.join(mysettings["PORTAGE_TMPDIR"], "portage")): + checkdir = os.path.join(mysettings["PORTAGE_TMPDIR"], "portage") + else: + checkdir = mysettings["PORTAGE_TMPDIR"] + + if not os.access(checkdir, os.W_OK): + writemsg("%s is not writable.\n" % checkdir + \ + "Likely cause is that you've mounted it as readonly.\n" \ + , noiselevel=-1) + return 1 + else: + from tempfile import NamedTemporaryFile + fd = NamedTemporaryFile(prefix="exectest-", dir=checkdir) + os.chmod(fd.name, 0755) + if not os.access(fd.name, os.X_OK): + writemsg("Can not execute files in %s\n" % checkdir + \ + "Likely cause is that you've mounted it with one of the\n" + \ + "following mount options: 'noexec', 'user', 'users'\n\n" + \ + "Please make sure that portage can execute files in this direxctory.\n" \ + , noiselevel=-1) + fd.close() + return 1 + fd.close() + del checkdir if mydo == "unmerge": return unmerge(mysettings["CATEGORY"], |