[Libguestfs] [PATCH 1/3] dib: unset all temporary dirs envvars in fake-sudo

Pino Toscano ptoscano at redhat.com
Tue Feb 21 14:39:20 UTC 2017


The real sudo does it as well, and leaving them when preserving the
environment (-E) maybe breaks the applications, as e.g. chroot will have
a TMPDIR path pointing outside of it.
---
 dib/dib.ml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dib/dib.ml b/dib/dib.ml
index df83ba1..d15cd19 100644
--- a/dib/dib.ml
+++ b/dib/dib.ml
@@ -301,6 +301,11 @@ if [ -z \"$preserve_env\" ]; then
     esac
   done
 fi
+# TMPDIR needs to be unset, regardless of -E
+unset TMPDIR
+# ... and do that also to the other \"TMPDIR\"-like variables
+unset TMP
+unset TMP_DIR
 
 cmd=$1
 shift
-- 
2.9.3




More information about the Libguestfs mailing list