Help needed to fix FilterActionEncryptTest::shouldEncrypt(PGP*) unit tests
Friedrich W. H. Kossebau
kossebau at kde.org
Wed Aug 18 16:34:50 BST 2021
(Sandro, Ingo, okay to just reply to kde-pim in the future? does this thread
now have your awareness, and will so future replies? :) )
Am Mittwoch, 18. August 2021, 16:05:06 CEST schrieb Sandro Knauß:
> > Just, adding the same line to the gpg.conf file which gets deployed to the
> > temporary home during the unit test run did not change the error there. :(
>
> Well gpg.conf is not the same like gpg-agent.conf! Please create a
> gpg-agent.conf.
Added also a gpg-agent.conf with that line, but still failing.
> > Also changed code to set explicitly the GnupgHome property on the
> > MessageComposer::EncryptJob, so it sets it on the QGpgME::Job::context, in
> > case the env var GNUPGHOME as set by the test's GPGHelper is ignored, but
> > also to no effect.
>
> Wait - now you are talking about tests of messagelib/messagecomposer.
Nono, FilterActionEncrypt::process() (mailcommon) is using
MessageComposer::EncryptJob (messagelb) and the very error we talk about is
delivered from that very job class, thus I also inspected these things down
there at the call chain :)
See here where the very error is delivered in the code:
https://invent.kde.org/pim/mailcommon/-/blob/master/src/filter/filteractions/
filteractionencrypt.cpp#L182
(Good to see I am not the only one confused by all the distributed code,
already had lots of times where I rebuild and installed to test something,
only to find the file I had edited was from another repo :) )
> > But at least we got one step further I think. So what could be the next
> > steps to try?
>
> I would suggest, that you print out the gpghome that gpg is using (gpg --
> version). Also check the engineHomeDirectory of the QGpgME::Job::context. I
> expect that those are not correctly set.
What I had done was to change the test code to keep the temporary working dir
(and fprint it so I know the path). Then used it explicitly as GPGHOME. Here
the --version info (testing engineHomeDirectory() needs me to get around
fixing the build currently) due to 3rd-party breakage, later tonight):
--- 8< ---
$ LANG=C GNUPGHOME=/tmp/filteractionencrypttest-FkXyit/gpghome gpg --version
gpg: WARNING: unsafe permissions on homedir '/tmp/filteractionencrypttest-
FkXyit/gpghome'
gpg (GnuPG) 2.2.27
libgcrypt 1.9.3-unknown
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /tmp/filteractionencrypttest-FkXyit/gpghome
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
--- 8< ---
> Also it may be a test to run the tests when you first copy the gnupghome by
> and end export GNUPGHOME:
> export GNUPGHOME = <path>
>
> than do manual encrypt/decrypt:
> gpg -e -r kmail at test.kde -o encrypt.asc
Perhaps this one already sheds more light/shadows indicating something for
you, as it gives us the very error message?
--- 8< ---
$ LANG=C GNUPGHOME=/tmp/filteractionencrypttest-FkXyit/gpghome gpg -e -r
kmail at test.kde -o encrypt.asc testfile.txt
gpg: WARNING: unsafe permissions on homedir '/tmp/filteractionencrypttest-
FkXyit/gpghome'
gpg: WARNING: running with faked system time: 2013-01-10 15:48:12
gpg: key 358732559B8659B2 was created 1663 days in the future (time warp or
clock problem)
gpg: key 358732559B8659B2 was created 1663 days in the future (time warp or
clock problem)
gpg: key 358732559B8659B2 was created 1663 days in the future (time warp or
clock problem)
gpg: key 358732559B8659B2 was created 1663 days in the future (time warp or
clock problem)
gpg: error retrieving 'kmail at test.kde' via Local: Unusable public key
gpg: error retrieving 'kmail at test.kde' via WKD: No data
gpg: kmail at test.kde: skipped: No data
gpg: testfile.txt: encryption failed: No data
--- 8< ---
Thanks for your patience so far :)
Cheers
Friedrich
More information about the kde-pim
mailing list