Ghost options generated from argp

Rickard Jonsson
Thu Sep 29 00:36:00 GMT 2016


When using argp the compiled software will have an extra option that is
not present in argp_options present in project source nor
argp_default_options in glibc/argp/argp-parse.c

The option only has a long version and takes an argument which is an
empty string, making it look like:
(There is a large gap in the output and seems like a tab for me, may be
wrong however)

The exact option and position varies, when the same source code is 
compiled on different computers it changes, adding printf() calls in 
source code seem to also change the option.

Seeing as I couldn't find any mentions of this on the internet nor the
bug tracker combined with the fact that this is the first time I'm
trying to use argp, there's a fairly high chance this is not a bug,
which is why I'm asking here first.

For a code sample, I've posted source code with the problem present in
the following url:
NOTE: Will trigger download prompt in most cases.

Compiling with -Wpedantic -Wall -Werror generates no additional output
from using no flags at all.

- In the file linked, removing one option as well as the call to
  argp_help() seems to remove the issue.
- The issue disappears by moving struct argp_options[] and 
  struct argp into main from
  the global scope and removing the call to argp_help().

Rickard Jonsson

More information about the Libc-help mailing list