Reported by Brian Lee on gnupg-devel for gpg version 2.5.24: https://lists.gnupg.org/pipermail/gnupg-devel/2026-October/036494.html
Reported for MacOS, but the problem is reproducible on Linux.
Slightly adjusted test script:
export TESTDIR=$PWD/testdir export GNUPGHOME=$TESTDIR/.gnupg mkdir -p -m 700 $GNUPGHOME && echo use-keyboxd > $GNUPGHOME/common.conf gpg --batch --passphrase '' --quick-gen-key test@example.org ed25519 sign never echo hello > $TESTDIR/msg gpg --batch -u test@example.org --detach-sign $TESTDIR/msg gpg -K gpg --verify $TESTDIR/msg.sig $TESTDIR/msg # Now use either: cp $GNUPGHOME/trustdb.gpg $TESTDIR/tdb.gpg && chmod 000 $TESTDIR/tdb.gpg gpg --trustdb-name $TESTDIR/tdb.gpg --verify $TESTDIR/msg.sig $TESTDIR/msg ## prints gpg: Fatal: can't open './tdb.gpg': Permission denied ## then hangs # Or: chmod 400 $GNUPGHOME/trustdb.gpg gpg --check-trustdb ## prints gpg: Note: trustdb not writable ## gpg: trustdb rec 32: write failed (n=-1): Bad file descriptor ## gpg: Fatal: /home/thomas/g10code/testgh/.gnupg/trustdb.gpg: failed to append a record: Bad file descriptor ## then hangs
Both variants of the script produce a legitimate error message. However, after that, gpg hangs.
The reporter has provided additional analysis on the mailing list.