Maybe the solution would be to stop using gpg-error-config and start using pkgconfig instead?
$ pkgconf --libs gpg-error -lgpg-error
Maybe the solution would be to stop using gpg-error-config and start using pkgconfig instead?
$ pkgconf --libs gpg-error -lgpg-error
Another problem seems to be that libtool/automake does not differentiate between library dependencies needed for building the library itself and library dependencies that should be exported to users of the library. There's just mylib_la_LIBADD for specifying the internal/private library dependencies and those also end up as dependencies in the .la file. Or maybe the dependencies in the .la file are used by the original libtool only for building static libraries and it's slibtool's fault to also copy the dependencies verbatim when building a shared library.
I have checked where -L/usr/lib64 comes from. Ultimately, it seems to come from gpg-error-config --libs which outputs -L/usr/lib64 -lgpg-error. I have no idea why gpg-error-config --libs adds the -L/usr/lib64, but this seems very dangerous to me and was bound to cause trouble because a -L applies to everything that follows and not just to the following -l.
One idea would be that gpgme installs its libraries in a directory like /usr/lib64/gpgme/, but that might be too disruptive?
Yes, you are correct.
[pid 1252] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 [pid 1252] access("../../cpp/src/.libs/libqgpgme.so", F_OK) = -1 ENOENT (No such file or directory) [pid 1252] access("../../cpp/src/.libs/libqgpgme.a", F_OK) = -1 ENOENT (No such file or directory) [pid 1252] access("../../cpp/src/../../../src/.libs/libqgpgme.so", F_OK) = -1 ENOENT (No such file or directory) [pid 1252] access("../../cpp/src/../../../src/.libs/libqgpgme.a", F_OK) = -1 ENOENT (No such file or directory) [pid 1252] access("/usr/lib64/libqgpgme.so", F_OK) = 0 [pid 1252] openat(AT_FDCWD, "/usr/lib64/libqgpgme.so", O_RDONLY|O_CLOEXEC) = 3 [pid 1252] newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=1253896, ...}, AT_EMPTY_PATH) = 0 [pid 1252] mmap(NULL, 1253896, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, 3, 0) = 0x7fe6f6ffa000 [pid 1252] rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0 [pid 1252] close(3) = 0
As it shows it checks the linker path in the order they are passed to the compiler and then finds the old system library before the newly built library. GNU libtool also sets the /usr/lib64 path before the using libqgpgme library, but avoids this by using the .so file directly. Presumably this is only on compatible platforms and maybe even a problem on less compatible platforms? I'm not sure the ramifications of slibtool trying to reorder the library paths itself. Hopefully the slibtool dev has some time to also share their thought soon.
You probably have to call strace with -f, so that processes started by clang are also straced.
I attached the strace log of the failing clang command, but I am not seeing anywhere where it finds libqgpgme on the system, Maybe I'm doing something wrong?
Your observations seem to confirm that the linking picks up the old 1.17.1 version of libqgpgme instead of the newly built one. You could use strace to dispel last doubts. In any case this very much looks like a problem in slibtool.
In retrospect this might be better handled in slibtool itself. I'll try to contact the main dev behind the slibtool project, but they have been very busy lately so it might take some time.
Additionally, moving the -L../src/.libs -lqgpgme earlier in the command line works.
clang++ t-revokekey.o t-support.o -g -O2 -L../../cpp/src/.libs -lgpgmepp -L../../cpp/src/../../../src/.libs -lgpgme -L../src/.libs -lqgpgme -L/usr/lib64 -lassuan -lgpg-error -lassuan -L../src/../../cpp/src/.libs -lgpgmepp -L../src/../../cpp/src/../../../src/.libs -lgpgme -lassuan -lgpg-error -L../src/../../../src/.libs -lQt5Core -L../../../src/.libs -lgpgme -lassuan -lgpg-error -lQt5Test -lQt5Core -lstdc++ -o .libs/t-revokekey
After some experimenting I found how GNU libtool avoids this.
Another interesting detail is that this is reproduced when trying to update to 1.18.0 from 1.17.1 which is installed on the system, but if 1.17.1 is built without qt5 support and 1.18.0 is then this issue is not reproducible.
revokekeyjob.moc is included by job.cpp (as many other *job.moc files). The missing symbols should be available in the built libqgpgme.so
Hmm. There is a -L/usr/lib64 before -L../src/.libs. I guess this causes problems if there is a /usr/lib64/libqgpgme.la because this will be found before the newly built libqgpgme.la in the build directory.
revokekeyjob.moc is included by job.cpp (as many other *job.moc files). The missing symbols should be available in the built libqgpgme.so. The command line
rdlibtool: link: clang++ t-revokekey.o t-support.o -g -O2 -L../../cpp/src/.libs -lgpgmepp -L../../cpp/src/../../../src/.libs -lgpgme -L/usr/lib64 -lassuan -lgpg-error -lassuan -L../src/.libs -lqgpgme -L../src/../../cpp/src/.libs -lgpgmepp -L../src/../../cpp/src/../../../src/.libs -lgpgme -lassuan -lgpg-error -L../src/../../../src/.libs -lQt5Core -L../../../src/.libs -lgpgme -lassuan -lgpg-error -lQt5Test -lQt5Core -lstdc++ -o .libs/t-revokekey
includes -L../src/.libs -lqgpgme. So it should link against the newly built library and not against an installed library.
Dear ikloecker,
I have no idea why OpenKeyChain cannot decrypt TestFileB.pdf.gpg. Here is the packet list (with automatic decryption).
$ gpg --list-packets TestFileB.pdf.gpg gpg: encrypted with rsa3072 key, ID B29C3E00B6EF27FA, created 2022-08-12 "TestKey4 <TestKey4@Email>" # off=0 ctb=85 tag=1 hlen=3 plen=396 :pubkey enc packet: version 3, algo 1, keyid B29C3E00B6EF27FA data: [3071 bits] # off=399 ctb=d2 tag=18 hlen=2 plen=0 partial new-ctb :encrypted data packet: length: unknown mdc_method: 2 # off=420 ctb=a3 tag=8 hlen=1 plen=0 indeterminate :compressed packet: algo=1 # off=422 ctb=90 tag=4 hlen=2 plen=13 :onepass_sig packet: keyid BBF1585AFE6385A9 version 3, sigclass 0x00, digest 10, pubkey 1, last=1 # off=437 ctb=cb tag=11 hlen=2 plen=0 partial new-ctb :literal data packet: mode b (62), created 1660319025, name="", raw data: unknown length
$ gpg --list-packets TestFileA.pdf.gpg gpg: encrypted with ECDH key, ID 8594A0FBC4AFAF88 gpg: public key decryption failed: No secret key gpg: decryption failed: No secret key # off=0 ctb=84 tag=1 hlen=2 plen=94 :pubkey enc packet: version 3, algo 18, keyid 8594A0FBC4AFAF88 data: [263 bits] data: [392 bits] # off=96 ctb=d4 tag=20 hlen=2 plen=0 partial new-ctb :aead encrypted packet: cipher=9 aead=2 cb=16 length: unknown
-> This still uses AEAD. It seems Werner's method to remove the AEAD feature doesn't work. At least not with gpg 2.3.7.
$ gpg --edit-key 8594A0FBC4AFAF88 Secret key is available.
Hello All,
@werner @ikloecker I tend to agree with the original reporter that this is an issue. Not a Bug, but an issue that causes problems for our Users. At least we should have some way in Kleopatra to disable "Advanced Features". Then users could be pointed to some screenshots how to disable AEAD.
Here is an example on how to remove the AEAD preference from a key using GnuPG 2.3:
As an alternative you may change the preferences on the key to adjust them to your changed/downgraded version.
Observations:
Some details about TestKey3:
$ gpg --show-keys backup_2022-08-11.sec pub rsa3072/BBF1585AFE6385A9 2022-08-12 [SC] 4AFA1B0808A82E3EF941B067BBF1585AFE6385A9 uid TestKey3 <TestKey3@Email> sub rsa3072/F3E9DFE37D777AEF 2022-08-12 [E]
Some details about TestKey1_0x31B038AA:
$ gpg --show-keys --verbose TestKey1_0x31B038AA_public.asc pub ed25519/CD1E530031B038AA 2022-08-12 [SC] [expires: 2024-08-11] A438C95B6CAA724BC9F3DEB9CD1E530031B038AA uid TestKey1 <TestKey1@Email> sub cv25519/B390B84B58866C6A 2022-08-12 [E] [expires: 2024-08-11]
Here are two keys that I created on OpenKeyChain. They are in an encrypted backup file:
Here are two test keys I created with gpg4win 4.0.3 after reinstalling.
Please don't yell at us!
Apologies for the delay here, but the particular user claimed it was no longer an issue and it fell off my radar. However I now have a new individual with the same problem.
In T6129#161497, @werner wrote:We are currently investigating another problem with a new feature. Thus things are delayed. Hopefully we get a new release this month (or at least a new gnupg 2.3 version to install on top of gpg4win).
We are currently investigating another problem with a new feature. Thus things are delayed. Hopefully we get a new release this month (or at least a new gnupg 2.3 version to install on top of gpg4win).
Is it possible to have a gpg4win ETA that fixes this bug? thank you
Indeed, you are right. The object created by with can be valid even after the context (when referenced by another object).
Not sure if that is the complete fix - if you do something like:
with gpg.Context(...) as context: ... ... cause an exception after the context has been closed ...
then context will still be a valid reference to the gpg.Context instance, and may cause segfaults when something tries to access things inside it (f.e. for serialisation).
I like your previous solution with the accessor checks, because that actually fixes the issue.
Stylistically, maybe __del__ should just be renamed to cleanup or free, and then make sure to call that function from both __exit__ and __del__.
I think the fix should be something like this:
diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 81f961d9..95fd0cba 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -1189,8 +1189,9 @@ class Context(GpgmeWrapper): def __enter__(self): return self
@jap Thank you.
Should be fixed. A copy of an older version of pinentry's source code that can be built with Q4 is now included and will result in a pinentry-qt4 executable. Note that while we won't break this pinentry intentionally we won't maintain it either.
Can confirm, we've been running into this as well, but never filed a bug report. Our solution is to have this in our codebase:
The SEGV was due to access to gpgme library after self.wrapped is set to None in the __del__ function.
The commit is: rMb2f224a471fe: python: Reset passphrase callback correctly..
Thank you for the patch. You are right.
Looks good. After entering a wrong passphrase three times Kleopatra now reports
Moving the key to the card failed: Bad passphrase
Please reopen my issue. This is a serious issue that we encounter and do not have any explication.
Hi!
No, it's not waiting for the password. This was a 2 times error happening on our server.
We already provided the password but it was hung. We entered different things but it won't make anything.
I can tell you it doesn't wait for anything because we tested the same command on 2 different machines. On one machine it was hung, on another it worked.
gpg was waiting for the passphrase for the signing key to be provided via stdin.
With my patch I see the expected status message:
The problem seems to be that we don't return a status code with the
actual error via the --command-fd interface:
@gniibe Perfect, I got the update during the night actually. Thanks a lot for your work 🙏 .
For the firmware 5.4.3, I confirmed that it works well with the changes:
https://dev.gnupg.org/T6070#160150
Hi lovely people,
@gniibe thanks for help.
I have exactly this problem with yubikey here,
since i upgraded to gpg4win version 4.0.3 which contains gnupg 2.3.7 i get the same error as openpgp key not recognized.
@tigernero 2.3.8 is not yet released. Pretty sure gpg4win is a separate project, presumably you'll see a changelog entry here (as there is bumping to 2.3.7 in the latest 4.0.3) when it's in:
https://www.gpg4win.org/change-history.html
https://www.gpg4win.org/support.html
The provided change does not look like fixing the problem for me. The path to gpgconf is still wrong and I am getting the same error both with master and with the patched tarballs:
make[2]: Entering directory '/home/jjelen/devel/gnupg/tests/tpm2dtests' LC_ALL=C EXEEXT= PATH="../gpgscm:/home/jjelen/.local/bin:/home/jjelen/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin" abs_top_srcdir="/home/jjelen/devel/gnupg" objdir="/home/jjelen/devel/gnupg" TPMSERVER="" SWTPM="/bin/swtpm" SWTPM_IOCTL="/bin/swtpm_ioctl" GNUPG_BUILD_ROOT="/home/jjelen/devel/gnupg/tests" GPGSCM_PATH="/home/jjelen/devel/gnupg/tests/gpgscm" /home/jjelen/devel/gnupg/tests/gpgscm/gpgscm \ /home/jjelen/devel/gnupg/tests/tpm2dtests/run-tests.scm gpgscm: error running '/home/jjelen/devel/gnupg/tests/tools/gpgconf': probably not installed (wait-process "/home/jjelen/devel/gnupg/tests/tools/gpgconf" 2693795 #t): Configuration error
I can't find a url to download gnupg 2.3.8 for windows is it possible to know when gpg4win v.4.0.4 is out which fixes this bug? because currently on windows systems I am stuck using yubikey.
It is unlikely that the tofu stuff will get into widespread use in the 2.2 version - if at all.
Fixed in master.
I tried to reproduce this as we had similar problems in the past, but for me this works with full unicode characters.
Hi Marcel!
I just confirmed that firmware 5.4.3 works fine with the changes (to be 2.2.37 and 2.3.8).
Sure... it's really more of a cosmetic issue. Even without verbose mode, it should become quickly clear to anyone.
New release of libassuan is expected to make sure it's cleared off.
What I found: When the page is served by the server, it omits "charset=utf-8" part. This is the issue.
I used to have the option of generating PGP Keys up to 4,096 key size. That function has completely disappeared.
Probably fixed meanwhile in 2.2.
Please re-open if experience this problem also with a decent gnupg 2.2 versions.