Test if TMPDIR is a directory in apt-key and if not unset it
authorMichael Vogt <mvo@debian.org>
Mon, 29 Sep 2014 09:43:37 +0000 (11:43 +0200)
committerMichael Vogt <mvo@debian.org>
Mon, 29 Sep 2014 09:43:37 +0000 (11:43 +0200)
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
test/integration/test-bug-728500-tempdir

index 83a7a31..7a3852e 100644 (file)
@@ -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
index 0451fc1..bdc38c3 100755 (executable)
@@ -27,3 +27,4 @@ fi
 unset TMPDIR
 
 testequal 'coolstuff' aptcache pkgnames
+testsuccess ls rootdir/var/lib/apt/lists/*InRelease