Closed alexanderkjall closed 4 years ago
It does seem to be a problem with the upstream library. I ran a C version of your sample and it produced the same results.
// Based on t-trustlist.c from gpgme
// Copyright (C) 2000 Werner Koch (dd9jn)
// Copyright (C) 2001, 2003, 2004 g10 Code GmbH
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <gpgme.h>
#define fail_if_err(err) do { \
if (err) { \
fprintf (stderr, "%s:%d: %s: %s\n", \
__FILE__, __LINE__, gpgme_strsource (err), \
gpgme_strerror (err)); \
exit (1); \
} \
} while (0)
int main() {
gpgme_ctx_t ctx;
gpgme_trust_item_t item;
gpgme_error_t err = GPG_ERR_NO_ERROR;
assert(gpgme_check_version(GPGME_VERSION));
err = gpgme_new(&ctx);
fail_if_err(err);
err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_OPENPGP);
fail_if_err(err);
// Also tried with a key in my keyring
err = gpgme_op_trustlist_start(ctx, "DF0C3D316B7312D5", 0);
fail_if_err(err);
while (!(err = gpgme_op_trustlist_next(ctx, &item))) {
printf ("l=%d k=%s t=%d o=%s v=%s u=%s\n",
item->level, item->keyid, item->type, item->owner_trust,
item->validity, item->name);
gpgme_trust_item_unref(item);
}
if (gpgme_err_code(err) != GPG_ERR_EOF) {
fail_if_err(err);
}
err = gpgme_op_trustlist_end(ctx);
fail_if_err(err);
gpgme_release(ctx);
return 0;
}
Compile with cc -lgpgme -pthread -o test test.c
After reading the gpg source, it seems that trust listing has been manually disabled. This appears to have been done in a commit all the way back in 2002.
I opened a bug upstream: https://dev.gnupg.org/T4834
If I run the following code:
Then it simple returns a empty TrustItems object.
Looking what gpgme does in strace produces the following calls:
And running that same command in my shell produces this result:
I would have expected that gpgme would return an error object.
(why gpgme tries to run an option that doesn't seem to exist is a bug for that library maybe?)