From 7ffac4c10144a8458fec6de03c58f3b49d081e5c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Sep 2014 11:43:37 +0200 Subject: [PATCH] Test if TMPDIR is a directory in apt-key and if not unset it This prevents a failure in mktemp -d - it will blindly trust TMPDIR and not use something else if the dir is not there. --- cmdline/apt-key.in | 3 +++ test/integration/test-bug-728500-tempdir | 1 + 2 files changed, 4 insertions(+) diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 83a7a31b9..7a3852ee8 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -384,6 +384,9 @@ if [ "$command" != "help" ]; then # gpg needs (in different versions more or less) files to function correctly, # so we give it its own homedir and generate some valid content for it + if [ ! -d "$TMPDIR" ]; then + unset TMPDIR + fi GPGHOMEDIR="$(mktemp -d)" CURRENTTRAP="${CURRENTTRAP} rm -rf '${GPGHOMEDIR}';" trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir index 0451fc1ed..bdc38c3ca 100755 --- a/test/integration/test-bug-728500-tempdir +++ b/test/integration/test-bug-728500-tempdir @@ -27,3 +27,4 @@ fi unset TMPDIR testequal 'coolstuff' aptcache pkgnames +testsuccess ls rootdir/var/lib/apt/lists/*InRelease -- 2.47.2