GpgME: gpgme_op_import_result() for crap data

Albrecht Dreß albrecht.dress at arcor.de
Tue Jan 15 19:42:05 CET 2019


Am 15.01.19 10:54 schrieb(en) Andre Heinecke:
> That is not an error but a status message. The difference is that the operation continues. E.g. if you provide two filenames and the second one contains valid data you will get the status message once but still something is imported.

O.k., understood.

>> I would expect that imports is not NULL, and imports->result indicate the error (probably GPG_ERR_INV_DATA).
> 
> I agree that it is bad. In Kleopatra I just treat empty results like an error happened.

My use case is the import of a single key in a MUA (from Autocrypt header, key server search, etc.).  Just telling the user “something went wrong” is somewhat unsatisfactory…

> But if you import two files and only one has an error Kleopatra also will not show it.

The GpgME gpgme_import_result_t and gpgme_import_status_t data structures could cover this case, as the latter is a linked list.  I.e. add a separate item for each key, with a NULL fpr and appropriate status for all failed attempts.

> You could use the new diagnostic interface to show the status output of GnuPG to the user in case an empty import result occured. I explicitly wanted to have that interface for such reasons where diagnostic output that is printed to stderr by GnuPG would otherwise be lost.
[snip]
> I've commited an example how to use it to the gpgme run-import test:

Thanks, that's a helpful hint!  Unfortunately available since 1.11.2 only, i.e. not in Stretch or Ubuntu 18.04 – more #ifdef's in the code!

Thanks again,
Albrecht.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20190115/f3c68578/attachment-0001.sig>


More information about the Gnupg-devel mailing list