From 3ee425cfe61fece15c6ad0479b29f6bfd43870b9 Mon Sep 17 00:00:00 2001 From: Waozi Date: Fri, 6 Nov 2026 22:22:17 -0300 Subject: [PATCH] Keep the APT repository test working under a long TMPDIR gpg-agent listens on sockets inside each GnuPG home, and Unix socket paths end at 107 bytes. Under an agent sandbox's long TMPDIR the agent could not start, and the test exited 2 with no output because key generation discarded gpg's errors. The test now uses /tmp when TMPDIR is long, and shows gpg's error when a test key cannot be created. --- tests/apt_repo_test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/apt_repo_test.sh b/tests/apt_repo_test.sh index 2e8efe404..b4922e651 100644 --- a/tests/apt_repo_test.sh +++ b/tests/apt_repo_test.sh @@ -3,6 +3,11 @@ # that differs from the published keyring or a deb that differs from its name. set -eu root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +# gpg-agent listens on sockets inside each GnuPG home, here and in +# build-apt-repo.sh, and Unix socket paths end at 107 bytes. A long TMPDIR +# (such as an agent sandbox's) would stop the agent, so use /tmp instead. +tmp=${TMPDIR:-/tmp} +[ "${#tmp}" -le 48 ] || { TMPDIR=/tmp && export TMPDIR; } work=$(mktemp -d) trap 'rm -rf "$work"' EXIT INT TERM version=9.8.7 @@ -25,7 +30,8 @@ make_deb() { new_key() { GNUPGHOME=$work/gpg-$1 && export GNUPGHOME mkdir -m 700 "$GNUPGHOME" - gpg --batch --quiet --passphrase '' --quick-gen-key "test $1 " rsa2048 sign never 2>/dev/null + gpg --batch --quiet --passphrase '' --quick-gen-key "test $1 " rsa2048 sign never 2>"$work/gpg-$1.log" || + { cat "$work/gpg-$1.log" >&2; fail "could not create the $1 test key"; } gpg --export > "$work/$1.gpg" gpg --armor --export-secret-keys unset GNUPGHOME