Libelektra: Os testes se comportam estranhamente em certos ambientes (pacotes debian)

Criado em 11 mai. 2018  ·  35Comentários  ·  Fonte: ElektraInitiative/libelektra

Antes de bc804c207df391c339d880d3487ea3c16eb4ee4e, os seguintes testes falharam em alguns ambientes ao construir pacotes debian:

  • testmod_blockresolver
  • testmod_crypto_openssl
  • testmod_crypto_gcrypt
  • testmod_crypto_botan
  • testmod_fcrypt

EDIT markus: Você também pode reproduzir o blockresolver e fcrypt problemas manipulando HOME e TMPDIR. Nenhuma construção de pacote é necessária.

log de erros

blockresolver

[package/stretch]  42/118 Test  #48: testmod_blockresolver ............***Failed    0.00 sec
[package/stretch] BLOCKRESOLVER     TESTS
[package/stretch] ==================
[package/stretch] 
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/blockresolver/testmod_blockresolver.c:70: error in test_BlockresolverWrite: blockresolver->kdbSet failed
[package/stretch] Compare <key = only the inside has changed
[package/stretch] >, with <key = inside block
[package/stretch] >
[package/stretch] in file /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/blockresolver/blockresolver/compare.block, line 5.
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/tests/cframework/tests.c:157: error in compare_line_files: comparing lines failed
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/blockresolver/testmod_blockresolver.c:72: error in test_BlockresolverWrite: files do not match as expected
[package/stretch] 
[package/stretch] testmod_blockresolver Results: 15 Tests done — 3 errors.

crypto_openssl

[package/stretch]  48/118 Test  #60: testmod_crypto_openssl ...........***Failed    5.32 sec
[package/stretch] CYPTO        TESTS
[package/stretch] ==================
[package/stretch] 
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/crypto/test_internals.h:263: error in test_gpg: failed to install the GPG test key
[package/stretch] 
[package/stretch] crypto_openssl Results: 65 Tests done — 1 error.

crypto_gcrypt

[package/stretch]  49/118 Test  #61: testmod_crypto_gcrypt ............***Failed    5.18 sec
[package/stretch] CYPTO        TESTS
[package/stretch] ==================
[package/stretch] 
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/crypto/test_internals.h:263: error in test_gpg: failed to install the GPG test key

crypto_botan

[package/stretch]  50/118 Test  #62: testmod_crypto_botan .............***Failed    5.41 sec
[package/stretch] CYPTO        TESTS
[package/stretch] ==================
[package/stretch] 
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/crypto/test_internals.h:263: error in test_gpg: failed to install the GPG test key

cripta

[package/stretch]  57/118 Test  #73: testmod_fcrypt ...................***Failed   15.03 sec
[package/stretch] FCRYPT       TESTS
[package/stretch] ==================
[package/stretch] 
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:159: error in test_gpg: failed to install the GPG test key
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:187: error in test_file_crypto_operations: kdb set failed
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:188: error in test_file_crypto_operations: file content did not change during encryption
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:191: error in test_file_crypto_operations: kdb get (pregetstorage) failed
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:195: error in test_file_crypto_operations: kdb get (postgetstorage) failed
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:196: error in test_file_crypto_operations: postgetstorage did not encrypt the file again
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:231: error in test_file_signature_operations: kdb set failed
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:232: error in test_file_signature_operations: file content did not change during encryption
[package/stretch] /home/jenkins/workspace/elektra-jenkinsfile/libelektra/src/plugins/fcrypt/testmod_fcrypt.c:235: error in test_file_signature_operations: kdb get failed
[package/stretch] 

discussão

Em # 1965, tivemos algumas discussões sobre a localização de bugs apontando para https://github.com/ElektraInitiative/libelektra/commit/356317a6ab811f524ebaa1dbf40f19477b966fc1 como o commit que fez os erros aparecerem. No entanto, limpar o ambiente não deve ter o efeito colateral de fazer os testes passarem.
Se os testes precisarem de certas configurações ambientais, eles devem defini-las.

bug

Comentários muito úteis

@ petermax2 o arquivo Vagrant e as etapas para reproduzir estão em # 2211. Espero que isso ajude a depurar o problema mais facilmente. Talvez seja realmente apenas um problema de ENV.

Todos 35 comentários

Obrigado por relatar isso separadamente!

Como um efeito colateral, https://build.libelektra.org/jenkins/job/elektra-git-buildpackage-jessie/ parece estar funcionando novamente desde ontem ...

GPG parece ter um problema com o ambiente limpo. Vou experimentar configurar a variável GNUPGHOME para /tmp . O GPG conta com este diretório (o padrão é ~/.gnupg/ ) para pesquisar seu chaveiro. Acho que a informação gpg-agent também está armazenada neste diretório. Configurá-lo no mesmo diretório para todos os testes também pode corrigir o erro de vários gpg-agents surgindo para cada execução de teste (consulte # 1928).

Sim, também pensei que os casos de teste de criptografia com falha estão relacionados ao # 1928. Parece que o gpg usa .gnupg abaixo do TMPDIR. (Pelo menos você vê um .gnupg restante após executar TMPDIR=`pwd`/x ctest --output-on-failure -R fcrypt ).

Os casos de teste fcrypt com falha podem mostrar um bug no tratamento de arquivos temporários, também relacionado ao TMPDIR.

parece que o gpg usa .gnupg abaixo do TMPDIR

esta é uma suposição errada. gpg usa ~ / .gnupg como padrão, então não está relacionado a TMPDIR, mas a HOME.

Observe também que definir GNUPGHOME para o mesmo diretório para todos os testes pode influenciar a execução paralela do teste.

esta é uma suposição errada

Qual suposição você quer dizer? Eu estava apenas referindo que recebo uma pasta .gnupg dentro do TMPDIR.

mkdir x && env TMPDIR=`pwd`/x ctest --output-on-failure -R fcrypt; find x
Test project /home/markus/Projekte/Elektra/build
    Start 64: testmod_fcrypt
1/1 Test #64: testmod_fcrypt ...................***Failed    0.02 sec
FCRYPT       TESTS
==================

/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:187: error in test_file_crypto_operations: kdb set failed
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:188: error in test_file_crypto_operations: file content did not change during encryption
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:191: error in test_file_crypto_operations: kdb get (pregetstorage) failed
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:195: error in test_file_crypto_operations: kdb get (postgetstorage) failed
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:196: error in test_file_crypto_operations: postgetstorage did not encrypt the file again
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:231: error in test_file_signature_operations: kdb set failed
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:232: error in test_file_signature_operations: file content did not change during encryption
/home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:235: error in test_file_signature_operations: kdb get failed

fcrypt Results: 39 Tests done — 8 errors.


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.03 sec

The following tests FAILED:
         64 - testmod_fcrypt (Failed)
Errors while running CTest
x
x/elektra-test.qPoz5P
x/elektra-test.qPoz5P/.gnupg
x/elektra-test.qPoz5P/.gnupg/random_seed
x/elektra-test.qPoz5P/.gnupg/trustdb.gpg
x/elektra-test.qPoz5P/.gnupg/pubring.kbx~
x/elektra-test.qPoz5P/.gnupg/pubring.kbx

isso ocorre porque algo nos testes (ctest?) define o diretório inicial de cada suíte de testes para um tmpdir em TMPDIR.
O GPG cria os arquivos em HOME, mas HOME é definido como TMPDIR / randomdir / pelo teste.
Portanto, meu ponto é que não é a única falha do tmpdir e o esforço de depuração não deve ser restrito a ele.

Eu acho que é uma boa ideia ter diretórios home separados para cada teste para que eles não influenciem uns aos outros (paralelização) e, portanto, não acho que substituir diretórios gpg para compartilhar um único diretório seja uma boa ideia.

Sim eu concordo.

# 1977 faz sentido? Ou deve ser feito depois de ctest terminar completamente?

Ou de outra forma: o gpg-agent sobrevive à execução de um único conjunto de testes ou eles são reaparelhados para cada conjunto de testes?

@ markus2330 Conforme mencionado em # 2040. Segui as instruções sobre como construir as imagens do Docker. Dentro do contêiner do docker, executei:

# cmake -DBUILD_DOCUMENTATION=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
# make -j16
# mkdir x
# TMPDIR=`pwd`/x ctest -R crypt .
Test project /elektra/build
    Start 46: testmod_crypto_openssl
1/3 Test #46: testmod_crypto_openssl ...........   Passed    1.32 sec
    Start 47: testmod_crypto_gcrypt
2/3 Test #47: testmod_crypto_gcrypt ............   Passed    1.16 sec
    Start 48: testmod_crypto_botan
3/3 Test #48: testmod_crypto_botan .............   Passed    1.52 sec

100% tests passed, 0 tests failed out of 3

Label Time Summary:
memleak    =   1.16 sec (1 test)

Total Test time (real) =   4.01 sec

Portanto (uma parte do) problema é que os casos de teste assumem que o TMPDIR está presente. E você não conseguiu reproduzi-lo porque sempre criou o diretório antes de executar os testes: smile:

Mas, para mim, fcrypt falha, mesmo quando x está presente (você não executou fcrypt). Mas com outras mensagens:

64: FCRYPT       TESTS
64: ==================
64: 
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:187: error in test_file_crypto_operations: kdb set failed
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:188: error in test_file_crypto_operations: file content did not change during encryption
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:191: error in test_file_crypto_operations: kdb get (pregetstorage) failed
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:195: error in test_file_crypto_operations: kdb get (postgetstorage) failed
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:196: error in test_file_crypto_operations: postgetstorage did not encrypt the file again
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:231: error in test_file_signature_operations: kdb set failed
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:232: error in test_file_signature_operations: file content did not change during encryption
64: /home/markus/Projekte/Elektra/current/src/plugins/fcrypt/testmod_fcrypt.c:235: error in test_file_signature_operations: kdb get failed
64: 
64: fcrypt Results: 39 Tests done — 8 errors.
1/1 Test #64: testmod_fcrypt ...................***Failed    0.02 sec

Mas funciona no meu contêiner (estou esperando há muito tempo para abandonar essa linha: rindo:) ...

jenkins<strong i="6">@924c627f07b8</strong>:/elektra/build$ ctest --output-on-failure -R fcrypt
Test project /elektra/build
    Start 59: testmod_fcrypt
1/1 Test #59: testmod_fcrypt ...................   Passed    1.07 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   1.08 sec
jenkins<strong i="7">@924c627f07b8</strong>:/elektra/build$ TMPDIR=`pwd`/x ctest --output-on-failure -R fcrypt
Test project /elektra/build
    Start 59: testmod_fcrypt
1/1 Test #59: testmod_fcrypt ...................***Failed    0.01 sec
FCRYPT       TESTS
==================

/elektra/tests/cframework/tests.c:80: error in init: mkdtemp failed
/elektra/tests/cframework/tests.c:90: error in init: mkstemp failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:159: error in test_gpg: failed to install the GPG test key
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:71: error in writeTestFile: can not write to temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:187: error in test_file_crypto_operations: kdb set failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:99: error in isTestFileCorrect: can not read from temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:191: error in test_file_crypto_operations: kdb get (pregetstorage) failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:99: error in isTestFileCorrect: can not read from temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:192: error in test_file_crypto_operations: file content could not be restored during decryption
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:195: error in test_file_crypto_operations: kdb get (postgetstorage) failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:99: error in isTestFileCorrect: can not read from temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:71: error in writeTestFile: can not write to temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:231: error in test_file_signature_operations: kdb set failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:99: error in isTestFileCorrect: can not read from temporary file
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:235: error in test_file_signature_operations: kdb get failed
/elektra/src/plugins/fcrypt/testmod_fcrypt.c:80: error in writeFaultySignatureFile: can not write to temporary file

fcrypt Results: 32 Tests done — 16 errors.


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.02 sec

The following tests FAILED:
        59 - testmod_fcrypt (Failed)
Errors while running CTest
jenkins<strong i="8">@924c627f07b8</strong>:/elektra/build$ mkdir x
jenkins<strong i="9">@924c627f07b8</strong>:/elektra/build$ TMPDIR=`pwd`/x ctest --output-on-failure -R fcrypt
Test project /elektra/build
    Start 59: testmod_fcrypt
1/1 Test #59: testmod_fcrypt ...................   Passed    1.06 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   1.07 sec
jenkins<strong i="10">@924c627f07b8</strong>:/elektra/build$

algumas coisas mais interessantes:

  • por que o mkdtemp falha?
  • clean_temp_home aparentemente já foi escrito para limpar coisas do gnupg. Por que não está funcionando?

    • parece que os nomes mudaram

  • mesmo quando o dir em TMPDIR existe, eu tenho falha no fcrypt (os outros testes passam)

    • ao não especificar passagens fcrypt TMPDIR

bem ... verifique os avisos de tests.c e tudo fica muito mais claro ...

Estou preparando um PR para isso, no entanto, que deve resolver alguns dos problemas.

Se alguém pudesse descobrir se fcrypt tem alguns caminhos rígidos especificados em algum lugar que poderiam levar à falha dos testes, isso seria ótimo.

Ìn # 2056 Eu limpo o TMPDIR gerado corretamente. Isso resolve o problema persistente do agente gpg.
Ele também corrige um problema com versões mais recentes do glibc que não ativavam o mkdtemp.

No entanto, o teste fcrypt ainda falha assim que TMPDIR é definido manualmente e acho que pode haver um bug real em algum lugar no código.

jenkins<strong i="8">@0585a86e6f5f</strong>:~/workspace/build$ pidof gpg-agent
jenkins<strong i="9">@0585a86e6f5f</strong>:~/workspace/build$ TMPDIR=`pwd`/tmp ctest --output-on-failure -R crypt
Test project /home/jenkins/workspace/build
    Start 51: testmod_crypto_openssl
1/4 Test #51: testmod_crypto_openssl ...........   Passed    1.58 sec
    Start 52: testmod_crypto_gcrypt
2/4 Test #52: testmod_crypto_gcrypt ............   Passed    1.34 sec
    Start 53: testmod_crypto_botan
3/4 Test #53: testmod_crypto_botan .............   Passed    1.83 sec
    Start 64: testmod_fcrypt
4/4 Test #64: testmod_fcrypt ...................***Failed    1.17 sec
FCRYPT       TESTS
==================

/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:187: error in test_file_crypto_operations: kdb set failed
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:188: error in test_file_crypto_operations: file content did not change during encryption
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:191: error in test_file_crypto_operations: kdb get (pregetstorage) failed
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:195: error in test_file_crypto_operations: kdb get (postgetstorage) failed
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:196: error in test_file_crypto_operations: postgetstorage did not encrypt the file again
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:231: error in test_file_signature_operations: kdb set failed
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:232: error in test_file_signature_operations: file content did not change during encryption
/home/jenkins/workspace/src/plugins/fcrypt/testmod_fcrypt.c:235: error in test_file_signature_operations: kdb get failed

fcrypt Results: 39 Tests done — 8 errors.


75% tests passed, 1 tests failed out of 4

Label Time Summary:
memleak    =   1.34 sec (1 test)

Total Test time (real) =   5.98 sec

The following tests FAILED:
     64 - testmod_fcrypt (Failed)
Errors while running CTest
jenkins<strong i="10">@0585a86e6f5f</strong>:~/workspace/build$ pidof gpg-agent
jenkins<strong i="11">@0585a86e6f5f</strong>:~/workspace/build$ ls -l tmp
total 0

No entanto, o teste fcrypt ainda falha assim que TMPDIR é definido manualmente e acho que pode haver um bug real em algum lugar no código.

Você está certo!

getTemporaryFileName em fcrypt.c não verifica o ambiente. Portanto, se nenhum tmpdir for especificado na configuração do plug-in, ele usará /tmp como fallback padrão.

Suponho que a priorização correta seria:

  1. plugin conf
  2. ambiente $TMPDIR
  3. substituto padrão /tmp

Você concorda?

ISO / IEC 9945 (POSIX): O caminho fornecido pela primeira variável de ambiente encontrada na lista TMPDIR, TMP, TEMP, TEMPDIR. Se nenhum desses for encontrado, "/ tmp".

Já que estamos usando mkdtemp (POSIX 2008) de qualquer maneira, você provavelmente poderia usá-lo também e se livrar de alguns códigos.

Obrigado pela informação! Você conseguiu verificar se a correção proposta em # 2090 corrige o problema de teste fcrypt no servidor de compilação?

se funciona em seu sistema com TMPDIR = dir / that / exists ctest -R fcrypt deve funcionar no servidor de compilação também.

O problema deve ser corrigido agora.

Eu concordo

Ainda parece haver algum tipo de estranheza com os testes. Eu executo algumas compilações do master principalmente para ajustar o executor e as configurações paralelas, uma vez que não fazemos mais hyperthreading. E em um caso, os testes falharam repentinamente com o mesmo problema de 'não foi possível instalar a chave' novamente:
https://build.libelektra.org/jenkins/blue/organizations/jenkins/libelektra/detail/master/122/pipeline/410

Desculpe acumular aqui, mas também encontrei o erro failed to install the GPG test key . Eu uso um vagrant artful32 vm e posso reproduzir consistentemente esses erros (branch master):

 55/198 Test  #55: testmod_crypto_gcrypt ....................***Failed    0.60 sec
CYPTO        TESTS
==================

/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/crypto/test_internals.h:273: error in test_gpg: failed to install the GPG test key

crypto_gcrypt Results: 65 Tests done — 1 error.
 66/198 Test  #66: testmod_fcrypt ...........................***Failed    0.03 sec
FCRYPT       TESTS
==================

/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:160: error in test_gpg: failed to install the GPG test key
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:188: error in test_file_crypto_operations: kdb set failed
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:189: error in test_file_crypto_operations: file content did not change during encryption
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:192: error in test_file_crypto_operations: kdb get (pregetstorage) failed
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:196: error in test_file_crypto_operations: kdb get (postgetstorage) failed
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:197: error in test_file_crypto_operations: postgetstorage did not encrypt the file again
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:232: error in test_file_signature_operations: kdb set failed
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:233: error in test_file_signature_operations: file content did not change during encryption
/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/fcrypt/testmod_fcrypt.c:236: error in test_file_signature_operations: kdb get failed

fcrypt Results: 39 Tests done — 9 errors.

Posso fornecer o vagrantfile via PR, se ajudar a reproduzir os erros.

Obrigado por relatar! Você pode nos dizer seu TMPDIR e CASA? Tente reproduzi-lo com env -i .

@ petermax2 Você tem tempo para dar uma olhada?

Para os erros acima:
TMPDIR: vazio
CASA: /home/jenkins/workspace/elektra-master-full-artful32/user

Quanto a env -i , mais um teste falha então:

 54/198 Test  #54: testmod_crypto_openssl ...................***Failed    0.31 sec
CYPTO        TESTS
==================

/home/jenkins/workspace/elektra-master-full-artful32/src/plugins/crypto/test_internals.h:273: error in test_gpg: failed to install the GPG test key

crypto_openssl Results: 65 Tests done — 1 error.

Não tenho certeza se isso é uma coincidência, mas esta foi a primeira vez que este teste falhou.

Posso investigar no fim de semana. @mpranj você poderia me enviar o arquivo vagrant, por favor?

@ petermax2 o arquivo Vagrant e as etapas para reproduzir estão em # 2211. Espero que isso ajude a depurar o problema mais facilmente. Talvez seja realmente apenas um problema de ENV.

$HOMEDIR não está sendo excluído após o caso de teste ser concluído, portanto, o gpg-agent continua em execução, o que causa o problema. Se GNUPGHOME for definido para um diretório diferente, o caso de teste será bem-sucedido novamente.

EDITAR: $HOMEDIR está sendo excluído corretamente, mas gpgagent não foi encerrado conforme o esperado.

EDIT v2:

vagrant@ubuntu-artful:~/libelektra/build$ gpg --list-key
gpg: directory '/home/vagrant/.gnupg' created
gpg: new configuration file '/home/vagrant/.gnupg/dirmngr.conf' created
gpg: new configuration file '/home/vagrant/.gnupg/gpg.conf' created
gpg: keybox '/home/vagrant/.gnupg/pubring.kbx' created
gpg: /home/vagrant/.gnupg/trustdb.gpg: trustdb created
vagrant@ubuntu-artful:~/libelektra/build$ pgrep agent
3630
vagrant@ubuntu-artful:~/libelektra/build$ rm -rf /home/vagrant/.gnupg
vagrant@ubuntu-artful:~/libelektra/build$ pgrep agent
3630
vagrant@ubuntu-artful:~/libelektra/build$

Obrigado pela investigação!

Existe alguma visão geral em que versão os env vars fazem o quê e desde quando o agente gpg fecha quando os arquivos são removidos?

Qual o melhor jeito de consertar isso?

Desculpe pela demora, não tive tempo para investigar mais até agora.

Existe alguma visão geral em que versão os env vars fazem o quê e desde quando o agente gpg fecha quando os arquivos são removidos?

Toda a documentação que consegui encontrar foi

_ (GNUPGHOME) Se definir o diretório usado em vez de "~ / .gnupg" ._ [1]

Qual o melhor jeito de consertar isso?

Não tenho certeza. Não parece haver uma única solução que resolva todos os problemas que enfrentamos com o GnuPG. Certa vez, tentei salvar os PIDs dos agentes GnuPG do startetd, mas não deu certo.

Você tem alguma ideia?

Origens

  • [1] [https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration.html](https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration.html)

Talvez não devêssemos tentar resolver todos os problemas possíveis e apenas suportar algumas versões do gnupg?

Quais versões do gnupg não se limpam após a remoção de seus arquivos? Eles são relevantes o suficiente para ainda apoiá-los? Talvez nós simplesmente desabilitemos os testes para eles?

Quais versões do gnupg não se limpam após a remoção de seus arquivos?

A versão do gpg do Ubuntu Artful (17.10) é a única versão até agora em que o agente não é encerrado após excluir o GNUPGHOME . Eu não vi esse comportamento em outras versões do gpg.

O GPG no Ubuntu Artful é 2.1.15. No Ubuntu 18.04.1, o gpg versão 2.2.4 é usado. A versão mais recente é 2.2.10.

Podemos adicionar uma nota de dependência de que gpg versão> = 2.2 é necessária.

Se entender as notas de lançamento corretamente, a rescisão é implementada na versão gpg 2.1.16. Consulte as notas de lançamento .

EDITAR: a nota de lançamento afirma que a rescisão só é implementada para Linux. O que significa que em outro sistema operacional devemos ter o mesmo problema. Vou testar no FreeBSD.

Vou testar no FreeBSD.

Sim, gpg-agent ainda está em execução após GNUPGHOME ser removido.

ATM Estou testando outra solução. Executar gpg-connect-agent KILLAGENT desliga o agente na versão gpg 2.2.4. Se nós execv este comando depois que o teste de unidade for concluído, o gpg-agent deve desligar. Vou testar esta solução no Linux e FreeBSD. Por favor, espere por um comentário ou esperançosamente um PR!

Abra novamente este problema se o problema ocorrer novamente.

Esta página foi útil?
0 / 5 - 0 avaliações

Questões relacionadas

mpranj picture mpranj  ·  4Comentários

sanssecours picture sanssecours  ·  3Comentários

dmoisej picture dmoisej  ·  3Comentários

e1528532 picture e1528532  ·  4Comentários

mpranj picture mpranj  ·  3Comentários