From cecf352aa71229d62d106e65d8881ff34253f048 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Wed, 12 Dec 2018 18:52:25 +0100 Subject: [PATCH] remove any reference to TMPDIR_SUFFIX. Using system tempdir is enough --- packer/tmp/tmp.go | 19 ++++++++----------- .../docs/other/environment-variables.html.md | 4 ---- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packer/tmp/tmp.go b/packer/tmp/tmp.go index 9ffb94ff0..753c7c668 100644 --- a/packer/tmp/tmp.go +++ b/packer/tmp/tmp.go @@ -1,28 +1,25 @@ // Package tmp provides temporary directory helpers. // // tmp stores temporary items in the system's -// temporary directory ( see os.TempDir ). +// temporary directory ( see os.TempDir ) unless +// a corresponding environment variable is set.git // -// When the $TMPDIR_SUFFIX environment variable -// is set, tmp will return paths under $TMPDIR_SUFFIX -// inside the system temporary directory. +// On Unix systems, it uses $TMPDIR if non-empty, else /tmp. +// On Windows, it uses GetTempPath, returning the first non-empty +// value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory. +// On Plan 9, it returns /tmp. // +// The directory is neither guaranteed to exist nor have accessible +// permissions. package tmp import ( "io/ioutil" "os" - "path/filepath" ) var tmpDir = os.TempDir() -func init() { - if d := os.Getenv("TMPDIR_SUFFIX"); d != "" { - tmpDir = filepath.Join(tmpDir, d) - } -} - // Dir creates a new temporary directory in the system temporary // directory with a name beginning with prefix and returns the path // of the new directory. diff --git a/website/source/docs/other/environment-variables.html.md b/website/source/docs/other/environment-variables.html.md index bd883804b..a9becdcf1 100644 --- a/website/source/docs/other/environment-variables.html.md +++ b/website/source/docs/other/environment-variables.html.md @@ -48,7 +48,3 @@ each can be found below: might be necessary to customize it when working with large files since `/tmp` is a memory-backed filesystem in some Linux distributions in which case `/var/tmp` might be preferred. - -- `TMPDIR_SUFFIX` - When set, packer will put temporary files under system - temporary directory + `TMPDIR_SUFFIX`. This allows to create & to give - specific rights to a directory ie: `chmod 777 $TMPDIR/$TMPDIR_SUFFIX/`