Skip to content

Conversation

@josch
Copy link

@josch josch commented Jan 19, 2025

  • detached and clear-signed data was swapped
  • instead of duplicating gnupghome and uids, use a global dictionary
  • export the keyring for each key in preparation for --keyring
  • store the fingerprint in the fpr attribute of a global dictionary
  • key name "imposter" is a misnomer, better is "unknown"
  • fix function name uknown -> unknown
  • export the "correct" GNUPGHOME as an environment variable
  • gpgv must be run with --output=- to write the signed text from a clearsigned file
  • Create a new temporary directory for GNUPGHOME

josch added 2 commits January 19, 2025 20:43
 - detached and clear-signed data was swapped
 - instead of duplicating gnupghome and uids, use a global dictionary
 - export the keyring for each key in preparation for --keyring
 - store the fingerprint in the fpr attribute of a global dictionary
 - key name "imposter" is a misnomer, better is "unknown"
 - fix function name uknown -> unknown
 - export the "correct" GNUPGHOME as an environment variable
Storing GNUPGHOME inside the build tree may result in the following when
calling gpg.Context().create_key():

gpg.errors.GPGMEError: gpgme_op_createkey: GnuPG: No agent running

This happens if the path to the build tree is so long, that the path to
the socket `S.gpg-agent` inside the GNUPGHOME exceeds 108 characters.
The limit comes from sockaddr_un.sun_path, see unix(7) or:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206

Long build paths are commonly found when building bmaptool inside sbuild
or on Debian gitlab CI.

By setting GNUPGHOME to a new temporary directory, which will likely be
placed in /tmp, we avoid problems with long paths to GNUPGHOME.
@josch
Copy link
Author

josch commented Jan 29, 2025

When trying out these changes in the Debian gitlab CI, we ran into the problem that calling gpg.Context().create_key() errored out with:

gpg.errors.GPGMEError: gpgme_op_createkey: GnuPG: No agent running

This happens if the path to the build tree is so long, that the path to the socket S.gpg-agent inside the $GNUPGHOME exceeds 108 characters. The limit comes from sockaddr_un.sun_path, see unix(7) or:

Long build paths are commonly found when building bmaptool inside sbuild or on Debian gitlab CI. For example, the following path will show the problem, because it is 112 characters long:

/builds/josch/bmap-tools/debian/output/source_dir/.pybuild/cpython3_3.13/build/tests/test-data/gnupg/S.gpg-agent

By setting $GNUPGHOME to a new temporary directory, which will likely be placed in /tmp, we avoid problems with long paths to $GNUPGHOME.

@josch
Copy link
Author

josch commented Feb 12, 2025

Hi @JPEWdev I hope you had a good FOSDEM! 🙂 Of all my pull requests this is the most important one, so if you find some time these days, maybe look at this pull request first.

I'd of course also be happy of a review of #32 and #41 and a new release with those features in it. The Debian freeze for the next stable release will happen in the middle of March and I'd be really great to have bmap-tools with the features I proposed in these pull requests in Debian Trixie. 😄

@JPEWdev JPEWdev merged commit 97cddaa into yoctoproject:main Feb 12, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants