[PATCH] doebuild: export SANDBOX_LOG=${T}/sandbox.log (bug 704848)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] doebuild: export SANDBOX_LOG=${T}/sandbox.log (bug 704848)

Zac Medico-2
In order to avoid a SANDBOX_LOG collision with another process
having the same pid when pid-sandbox is enabled, export a
unique SANDBOX_LOG value. The ${T} directory is a convenient
location, since it is guaranteed to exist and be writable during
relevant ebuild phases.

Bug: https://bugs.gentoo.org/704848
Signed-off-by: Zac Medico <[hidden email]>
---
 lib/portage/package/ebuild/_config/special_env_vars.py | 4 ++--
 lib/portage/package/ebuild/doebuild.py                 | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py
index 5e7ca6d47..dc01339f7 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -28,7 +28,7 @@ env_blacklist = frozenset((
  "PORTAGE_INTERNAL_CALLER", "PORTAGE_IUSE",
  "PORTAGE_NONFATAL", "PORTAGE_PIPE_FD", "PORTAGE_REPO_NAME",
  "PORTAGE_USE", "PROPERTIES", "RDEPEND", "REPOSITORY",
- "REQUIRED_USE", "RESTRICT", "ROOT", "SLOT", "SRC_URI", "_"
+ "REQUIRED_USE", "RESTRICT", "ROOT", "SANDBOX_LOG", "SLOT", "SRC_URI", "_"
 ))
 
 environ_whitelist = []
@@ -78,7 +78,7 @@ environ_whitelist += [
  "PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE", "PORTAGE_XATTR_EXCLUDE",
  "PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", "PYTHONDONTWRITEBYTECODE",
  "REPLACING_VERSIONS", "REPLACED_BY_VERSION",
- "ROOT", "ROOTPATH", "SYSROOT", "T", "TMP", "TMPDIR",
+ "ROOT", "ROOTPATH", "SANDBOX_LOG", "SYSROOT", "T", "TMP", "TMPDIR",
  "USE_EXPAND", "USE_ORDER", "WORKDIR",
  "XARGS", "__PORTAGE_TEST_HARDLINK_LOCKS",
 ]
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 584ff798b..92e9d755c 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -369,7 +369,6 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
  mysettings["RPMDIR"]  = os.path.realpath(mysettings["RPMDIR"])
 
  mysettings["ECLASSDIR"]   = mysettings["PORTDIR"]+"/eclass"
- mysettings["SANDBOX_LOG"] = mycpv.replace("/", "_-_")
 
  mysettings["PORTAGE_BASHRC_FILES"] = "\n".join(mysettings._pbashrc)
 
@@ -407,6 +406,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
  mysettings["WORKDIR"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "work")
  mysettings["D"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image") + os.sep
  mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
+ mysettings["SANDBOX_LOG"] = os.path.join(mysettings["T"], "sandbox.log")
  mysettings["FILESDIR"] = os.path.join(settings["PORTAGE_BUILDDIR"], "files")
 
  # Prefix forward compatability
--
2.24.1