Page MenuHome GnuPG

gpgconf: the questionable value 256 for flags in gpgrt_opt_t
Closed, ResolvedPublic

Description

In gnupg/tools/gpgconf.c, we have lines like:

{ aListComponents, "list-components", 256, N_("list all components") },

Here, we use the value 256 for the flag. When it was written in 2004, the value didn't have valid semantics in argsparse.
IIUC, it is a simple mistake and the correct value is 128 (ARGPARSE_OPT_COMMAND)

Currently, 256 has different semantics as ARGPARSE_OPT_CONFFILE.

Event Timeline

That was my fault in commit rG8fc9de8d6bf663f7c8419b42dab01f590a694d59 obviously I assumed that the macros were always used.

-#define ARGPARSE_OPT_COMMAND  (1<<8) /* The argument is a command.        */
+#define ARGPARSE_OPT_IGNORE   (1<<6) /* Ignore command or option.         */
+#define ARGPARSE_OPT_COMMAND  (1<<7) /* The argument is a command.        */

We should fix this and while doing this also make use of the newer macros.

werner triaged this task as Normal priority.Dec 21 2023, 7:07 PM
werner edited projects, added gnupg24; removed gnupg.
gniibe changed the task status from Open to Testing.Dec 25 2023, 2:11 AM
gniibe added a project: backport.

Fixed in rG2be53b214d1c: tools: Fix argparse table of gpgconf..
It would be good to apply this to 2.2, so, adding "backport" tag.

Is in 2.4.4 and will go into 2.2.43