#860 closed Bugs (Invalid)
program_options: long options use prefix only
Reported by: | goldwynr | Owned by: | nobody |
---|---|---|---|
Milestone: | Component: | None | |
Version: | None | Severity: | Problem |
Keywords: | Cc: |
Description
Using program_options defaults, while scanning for long_options, only the prefix is used. So long options which begin with the same alphabets result in ambiguous results. A program which takes --foo(-f), --fool(-l), --fooled(-d) as options currently works like the following: ~/program_options_tests$ ./a.out -f foo option selected ~/program_options_tests$ ./a.out -l fool option selected ~/program_options_tests$ ./a.out -d fooled option selected ~/program_options_tests$ ./a.out --fo error: ambiguous option fo ~/program_options_tests$ ./a.out --foo error: ambiguous option foo ~/program_options_tests$ ./a.out --fool error: ambiguous option fool ~/program_options_tests$ ./a.out --foole fooled option selected ~/program_options_tests$ ./a.out --fooled fooled option selected Expected results: ---------------- ./a.out --foo ./a.out --fool ./a.out --fooled should have been valid options ./a.out --foole should have been an invalid option Actual Results: -------------- ./a.out --foo ./a.out --fool failed. ./a.out --foole was accepted as --fooled option. The program used is attached.
Change History (5)
comment:2 by , 16 years ago
Logged In: YES user_id=343027 Originator: NO Shouldn't it provide compatible behavior with getopt_long(), by default? I consider it a bug that (by default) it accepts longopts I didn't specify, regardless of whether there's any shadowing of other options.
comment:3 by , 16 years ago
Logged In: YES user_id=321498 Originator: NO I don't think getopt_long is something we're required to emulate. It looks that whether this is bug or not is not clear, so I'm gonna close this bug report, at least until more users come and complain.
comment:4 by , 15 years ago
I'll complain too ;-) I think the default settings should work as the original poster expected.
Note:
See TracTickets
for help on using tickets.