Page MenuHome GnuPG

gpgme: gpgme_op_query_swdb() does not report error from gpgconf
Open, NormalPublic

Description

Noticed while looking at T5663: Kleopatra's "Check for updates" does not work.

This can be reproduced with tests/run-swdb. For example

$ ./run-swdb gpg4win Gpg4win-3.1.15
package ...: [none]
iversion ..: [none]
version ...: [none]
reldate ...: none
created ...: none
retrieved .: none
flags .....:

which runs gpgconf --query-swdb gpg4win Gpg4win-3.1.15 which, on manual run, prints an error message:

gpgconf: error in version string 'Gpg4win-3.1.15': Invalid argument

Event Timeline

The below change makes the function report a general error if gpgconf didn't write any output on stdout:

diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index 28f91158..21211366 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -1245,6 +1245,13 @@ gpgconf_query_swdb (void *engine,
         }
     }
 
+  if (!linelen)
+    {
+      /* gpgconf did not print anything to stdout,
+         most likely due to some error.  */
+      err = gpg_error (GPG_ERR_GENERAL);
+    }
+
  leave:
   free (linebuf);
   _gpgme_io_close (rp[0]);

Proper error handling would check the exit status of gpgconf and/or handle status messages.

werner triaged this task as Normal priority.Mon, Nov 15, 7:45 AM