commit:     13a9a7d17d80b9dae0543e54167d4bca7656e48b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  3 10:38:43 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Mar  3 10:38:43 2013 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=13a9a7d1

sandbox: use a non-shell var for the message path

By allowing the SANDBOX_MESSAGE_PATH var to be stored in the shell
environment and then modified on the fly, we run into a fun edge
case with the PM.  When a phase has finished running, it saves the
current environment.  When the next phase runs, it loads the env
from the previous run.  Since the message path var can contain a
pid, the previous run will no longer be valid.

Since we want this to simply be a way for the active sandbox to
pass information to the active libsandbox.so's, there's no need
to use an env var that the shell can save/reload.  As such, use a
variable name that the shell will skip.  Non-shell programs have
no problem with this.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 libsbutil/sbutil.h | 2 +-
 tests/script-10.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h
index 479734b..c76465f 100644
--- a/libsbutil/sbutil.h
+++ b/libsbutil/sbutil.h
@@ -46,7 +46,7 @@
 #define ENV_SANDBOX_BASHRC     "SANDBOX_BASHRC"
 #define ENV_SANDBOX_LOG        "SANDBOX_LOG"
 #define ENV_SANDBOX_DEBUG_LOG  "SANDBOX_DEBUG_LOG"
-#define ENV_SANDBOX_MESSAGE_PATH   "SANDBOX_MESSAGE_PATH"
+#define ENV_SANDBOX_MESSAGE_PATH "SANDBOX_MESSAGE_P@TH" /* @ is not a typo */
 #define ENV_SANDBOX_WORKDIR    "SANDBOX_WORKDIR"
 
 #define ENV_SANDBOX_DENY       "SANDBOX_DENY"

diff --git a/tests/script-10.sh b/tests/script-10.sh
index 801730e..aa62b01 100755
--- a/tests/script-10.sh
+++ b/tests/script-10.sh
@@ -5,7 +5,7 @@
 ret=0
 
 out=$(env -i env)
-for var in LOG DEBUG_LOG MESSAGE_PATH DENY READ WRITE PREDICT ON ACTIVE ; do
+for var in LOG DEBUG_LOG MESSAGE_P@TH DENY READ WRITE PREDICT ON ACTIVE ; do
        var="SANDBOX_${var}"
        oval=$(env | grep "^${var}=" | sed 's:^[^=]*=::')
 

Reply via email to