Skip to content

Commit 397ec68

Browse files
committed
gpg < 2.4 limits path to 180 chars, symlink gpg dir during import
The actual error occurs when the gpg-agent tries to create a unix socket Per default a gpg-agent is not started for things like --verify, --list etc. only when needing access to a private key (such as importing one). Hence, we apply the workaround only for importGpgKey and not in other cases where --homedir is used This also means we need to rewrite trustGpgKey as it currently uses --edit-key which again needs access to the private key => use --import-ownertrust instead, which again should not use a gpg-agent.
1 parent fb42d85 commit 397ec68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utility/gpg-utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ function importGpgKey() {
139139
grep pub <<<"$outputKey" | perl -0777 -pe "s#pub\s+[^/]+/([0-9A-Z]+).*#\$1#g" |
140140
while read -r keyId; do
141141
echo "establishing trust for key $keyId"
142-
trustGpgKey "$maybeSymlinkedGpgDir" "$keyId"
142+
# shellcheck disable=SC2310 # we are aware of that set -e has no effect for trustGpgKey that's why we use || return $?
143+
trustGpgKey "$maybeSymlinkedGpgDir" "$keyId" || return $?
143144
done || {
144145
local exitCode=$?
145146
cleanupMaybeSymlinkedGpgDir "$gpgDir" "$maybeSymlinkedGpgDir"

0 commit comments

Comments
 (0)