libelektra: MSR fails with crypto tutorial with ini as default storage
Steps to Reproduce the Problem
Apply the patch:
diff --git a/doc/tutorials/crypto.md b/doc/tutorials/crypto.md
index 3881eb8dc..37f09d275 100644
--- a/doc/tutorials/crypto.md
+++ b/doc/tutorials/crypto.md
@@ -35,6 +35,14 @@ If you have no GPG private key available, you can generate one by entering the f
The `fcrypt` plugin and the `crypto` plugin support both versions (version 1 and version 2) of GPG.
+In order to set up our tutorial we import the Elektra test key.
+We **DO NOT RECOMMEND** to use our key on your local machine, as it is available to the public!
+
+```sh
+gpg2 --import src/plugins/crypto/test_key.asc || gpg --import src/plugins/crypto/test_key.asc
+echo "trust-model always" > ~/.gnupg/gpg.conf
+```
+
## Introduction
In this tutorial we explain the use of the `crypto` plugin and the `fcrypt` plugin by a simple example:
diff --git a/tests/shell/shell_recorder/tutorial_wrapper/CMakeLists.txt b/tests/shell/shell_recorder/tutorial_wrapper/CMakeLists.txt
index 60e8241fe..d991a9b25 100644
--- a/tests/shell/shell_recorder/tutorial_wrapper/CMakeLists.txt
+++ b/tests/shell/shell_recorder/tutorial_wrapper/CMakeLists.txt
@@ -12,5 +12,7 @@ add_msr_test (kdb-ls "${CMAKE_SOURCE_DIR}/doc/help/kdb-ls.md")
add_msr_test (tutorial_validation "${CMAKE_SOURCE_DIR}/doc/tutorials/validation.md" REQUIRED_PLUGINS validation)
+add_msr_test (tutorial_crypto "${CMAKE_SOURCE_DIR}/doc/tutorials/crypto.md" REQUIRED_PLUGINS crypto_gcrypt fcrypt)
+
# Only works with super user privileges, since it writes to `/etc/hosts`:
# add_msr_test (tutorial_mount "${CMAKE_SOURCE_DIR}/doc/tutorials/mount.md")
Build Elektra with
cmake ..
-DKDB_DB_FILE='default.ini' \
-DKDB_DB_INIT='elektra.ini' \
-DKDB_DEFAULT_STORAGE=ini
Run the test:
ctest --output-on-failure -V -R testshell_markdown_tutorial_crypto
Expected Result
Test should succeed.
Actual Result
Every execution step in the test fails, including the import of the GPG key.
System Information
- Elektra Version: master
- local, Docker Container. build server: elektra-ini-mergerequest
Further Log Files and Output
n/a
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (25 by maintainers)
Commits related to this issue
- fcrypt: skip empty key IDs as recipients/signers I discovered this bug during my work on #1981 . If an empty recipient/signature key ID is defined, GnuPG reports an error because it receives invalid ... — committed to petermax2/libelektra by petermax2 5 years ago
- crypto: skip empty key IDs as recipients I discovered this bug during my work on #1981 . If an empty recipient is defined, GnuPG reports an error because it receives invalid command line arguments. — committed to petermax2/libelektra by petermax2 5 years ago
- tools: add tool for GPG test key generation This tool can be utilized in unit tests whenever a valid GPG key without a passphrase is being required. See #1981 for full discussion. — committed to petermax2/libelektra by petermax2 5 years ago
- doc: enable MSR for crypto tutorial Let MSR test the crypto.md tutorial. See #1981 for full discussion. — committed to petermax2/libelektra by petermax2 5 years ago
- build: add gen-gpg-testkey to TOOLS See #1981 . — committed to petermax2/libelektra by petermax2 5 years ago
This is a good question! Afaik it does not but you can simply use KDB to store anything. So you would write something like (untested):
We should definitely add this information to tests/shell/shell_recorder/tutorial_wrapper/README.md
Btw. the
kdb set /sw/elektrais quite dangerous, it might lead to data loss of the person executing the test. Tests should only write to /tests or, if the change is absolutely needed, restore what was in the KDB before.Actually there is a bug besides the limitation of how many plugins can exist (we are already working on this one). The bug is that
kdb mounteven tries to add thesyncplugin becausefcryptalready providessync, so adding thesyncplugin is not necessary. I tried to fix it in #2631.Status update: I have some progress to report.
fcryptis testable and running with MSR.cryptostill causes troubles. I’m still at it.This is the solution I’m currently following. It doesn’t look too bad:
Not quite, I thought about providing a small setup tool, that generates a new GPG test-key using libgpgme. I have to investigate further.
UPDATE: I found a way to generate a “scripted” key that is usable, however a passphrase has to be set, otherwise the
pinentrywill come up asking for a passphrase.GnuPG is not meant to be “test-automated”. 😆
EDIT: add missing “be” in the last sentence.
Not yet, I was just trying out
to have some key for testing. MSR still fails but the key generation seems to work.
I can’t promise to have progress during the week.
Sure, that’s possible.
except that this should not be done in the build server but in the test and reverted after the test is finished.
//EDIT: since I don’t want to sound like I am just passing work around because I do not want to do it: Imagine developer A at home wants to run the test. He does not care about the test server setting. A will get pissed because the test broke his setting.
@ingwinlu pointed out: