python-gpgme signature revokation assertion error: `gpg->cmd.code' failed
Open, NormalPublic

Description

I'm trying to use the python-gpg wrapper for GPGME to revoke a signature. My code is here: https://bitbucket.org/malb/batzenca/src/e891b2d4fad86bd36059d6da04de38775c68ef91/batzenca/gnupg.py#lines-543

However, I'm ending up with:

python3: ../../src/engine-gpg.c:800: command_handler: Assertion `gpg->cmd.code' failed.

This looks like a bug to me, but I might also be calling the library wrongly.

Details

Version
Python GPG 1.13
werner added a subscriber: werner.Jan 6 2020, 7:06 PM

I do not know this Python library. It looks like one of the older binding to GPGME. Please contact the author of gnupg.py or switch over to the Python language binding we provide with gpgme.

Hi, this is using the Python language bindings provided by GPGME. I am the author of gnupg.py which my attempt to use those bindings to revoke a signature.

werner added a comment.Jan 7 2020, 8:10 AM

Sorry, there have been quite some bindings with similar names, so I couldn't identify which one this is about. Can you please run with your test code with GPGME_DEBUG=9:/foo/gpgme.log set which makes it it easier to understand what is going on.

werner triaged this task as Normal priority.

Here's an excerpt of the output which should cover the critical step. Let me know if you need more/all.

GPGME 20200107T112801 223A  gpgme_debug: level=9
…
GPGME 20200107T113202 25F2  _gpgme_io_spawn: enter: path=/usr/bin/gpgconf
GPGME 20200107T113202 25F2  _gpgme_io_spawn: check: argv[ 0] = /usr/bin/gpgconf
GPGME 20200107T113202 25F2  _gpgme_io_spawn: check: argv[ 1] = --version
GPGME 20200107T113202 25F2  _gpgme_io_spawn: check: fd[0] = 0xc -> 0x1
GPGME 20200107T113202 25F2  _gpgme_io_spawn: check: waiting for child process pid=9735
GPGME 20200107T113202 2608    gpgme:max_fds: call: max fds=13 (/proc)
GPGME 20200107T113202 25F2    _gpgme_io_close: enter: fd=12
GPGME 20200107T113202 25F2    _gpgme_io_close: leave: result=0
GPGME 20200107T113202 25F2  _gpgme_io_spawn: leave: result=0
GPGME 20200107T113202 25F2  _gpgme_io_read: enter: fd=11 buffer=0x00007ffd33c605c0 count=79
GPGME 20200107T113202 25F2  _gpgme_io_read: check: gpgconf (GnuPG) 2.2.12<LF>
GPGME 20200107T113202 25F2  _gpgme_io_read: check: Copyright (C) 2018 Free Software Foundation, Inc
GPGME 20200107T113202 25F2  _gpgme_io_read: check: .<LF>
GPGME 20200107T113202 25F2  _gpgme_io_read: check: Licens
GPGME 20200107T113202 25F2  _gpgme_io_read: leave: result=79
GPGME 20200107T113202 25F2  _gpgme_io_close: enter: fd=11
GPGME 20200107T113202 25F2  _gpgme_io_close: leave: result=0
GPGME 20200107T113202 25F2  gpgme_new: enter: r_ctx=0x0000000001512310 
GPGME 20200107T113202 25F2  gpgme_new: leave: ctx=0x0000000001356570
GPGME 20200107T113202 25F2  gpgme_set_armor: call: ctx=0x0000000001356570 use_armor=0 (no)
GPGME 20200107T113202 25F2  gpgme_set_textmode: call: ctx=0x0000000001356570 use_textmode=0 (no)
GPGME 20200107T113202 25F2  gpgme_set_offline: call: ctx=0x0000000001356570 offline=0 (no)
GPGME 20200107T113202 25F2  gpgme_signers_clear: call: ctx=0x0000000001356570 
GPGME 20200107T113202 25F2  gpgme_set_pinentry_mode: call: ctx=0x0000000001356570 pinentry_mode=0
GPGME 20200107T113202 25F2  gpgme_set_protocol: enter: ctx=0x0000000001356570 protocol=0 (OpenPGP)
GPGME 20200107T113202 25F2  gpgme_set_protocol: leave: 
GPGME 20200107T113202 25F2  gpgme_get_protocol: call: ctx=0x0000000001356570 ctx->protocol=0 (OpenPGP)
GPGME 20200107T113202 25F2  gpgme_ctx_set_engine_info: enter: ctx=0x0000000001356570 protocol=0 (OpenPGP), file_name=(default), home_dir=/home/malb/.batzenca/gnupg
GPGME 20200107T113202 25F2    _gpgme_io_pipe: enter: inherit_idx=1 (GPGME uses it for reading)
GPGME 20200107T113202 25F2    _gpgme_io_pipe: leave: read fd=11 write fd=12
GPGME 20200107T113202 25F2    _gpgme_io_spawn: enter: path=/usr/bin/gpg
GPGME 20200107T113202 25F2    _gpgme_io_spawn: check: argv[ 0] = /usr/bin/gpg
GPGME 20200107T113202 25F2    _gpgme_io_spawn: check: argv[ 1] = --version
GPGME 20200107T113202 25F2    _gpgme_io_spawn: check: fd[0] = 0xc -> 0x1
GPGME 20200107T113202 25F2    _gpgme_io_spawn: check: waiting for child process pid=9737
GPGME 20200107T113202 260A      gpgme:max_fds: call: max fds=13 (/proc)
GPGME 20200107T113202 25F2      _gpgme_io_close: enter: fd=12
GPGME 20200107T113202 25F2      _gpgme_io_close: leave: result=0
GPGME 20200107T113202 25F2    _gpgme_io_spawn: leave: result=0
GPGME 20200107T113202 25F2    _gpgme_io_read: enter: fd=11 buffer=0x00007ffd33c5f430 count=79
GPGME 20200107T113202 25F2    _gpgme_io_read: check: gpg (GnuPG) 2.2.12<LF>
GPGME 20200107T113202 25F2    _gpgme_io_read: check: libgcrypt 1.8.4<LF>
GPGME 20200107T113202 25F2    _gpgme_io_read: check: Copyright (C) 2018 Free Software Foundation,
GPGME 20200107T113202 25F2    _gpgme_io_read: leave: result=79
GPGME 20200107T113202 25F2    _gpgme_io_close: enter: fd=11
GPGME 20200107T113202 25F2    _gpgme_io_close: leave: result=0
GPGME 20200107T113202 25F2  gpgme_ctx_set_engine_info: leave: 
GPGME 20200107T113202 25F2  gpgme_set_keylist_mode: call: ctx=0x0000000001356570 keylist_mode=0x4
GPGME 20200107T113202 25F2  gpgme_set_armor: call: ctx=0x0000000001356570 use_armor=1 (yes)
GPGME 20200107T113202 25F2  gpgme_set_textmode: call: ctx=0x0000000001356570 use_textmode=1 (yes)

I also see python3: ../../src/engine-gpg.c:800: command_handler: Assertion gpg->cmd.code' failed.` on stderr.