From d3c89d85b6492432b37c6cbec68662613da8178e Mon Sep 17 00:00:00 2001 From: Ghe Rivero Date: Wed, 15 Oct 2014 15:58:47 +0000 Subject: [PATCH] Force empty $TMPDIR inside the chroot There are some situations (use of libpam-tmpdir) where the $TMPDIR is defined per user, so any sudo call will define an specific $TMPDIR for the root user which doesn't exist inside the chroot. Change-Id: I866651fed520007506c7be83837d3791ed9f2235 Closes-Bug: #1330290 --- lib/img-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/img-functions b/lib/img-functions index 64079bd4..b2f2aa54 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -64,7 +64,10 @@ function run_in_target () { # -E to preserve http_proxy ORIG_HOME=$HOME export HOME=/root - sudo -E chroot $TMP_MOUNT_PATH sh -c "$cmd" + # Force an empty TMPDIR inside the chroot. There is no need to use an user + # defined tmp dir which may not exist in the chroot. + # Bug: #1330290 + sudo -E TMPDIR= chroot $TMP_MOUNT_PATH sh -c "$cmd" export HOME=$ORIG_HOME }