Opened 9 years ago

Closed 8 years ago

#9630 closed Bugs (fixed)

Program Options: canonical option name incorrect when hyphenated

Reported by: Tad Ashlock <tad.ashlock@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

When using a long option name like "external-device", if there is a problem, the name of the option in the error message is printed as "--device" instead of "--external-device". This is due to the implementation in error_with_option_name::get_canonical_option_name() in the value_semantic.cpp file. It calls strip_prefixes() when assigning the value to original_token. But strip_prefixes() simply uses find_last_of("-/"), which finds the dash within the option name and incorrectly uses the following character as the start of the option name.

I don't know the proper fix to apply in order to not cause errors in other uses of these functions.

Change History (3)

comment:1 by Daniel Hams <daniel.hams@…>, 8 years ago

Looks like this may have been fixed by

https://svn.boost.org/trac/boost/changeset/82805

and see ticket

https://svn.boost.org/trac/boost/ticket/8009

(I was having the same error with 1.54 and came to look up if/when it was fixed, found this ticket in addition to the other one).

Maybe you could close it if it works for you now?

in reply to:  1 comment:2 by Tad Ashlock <tad.ashlock@…>, 8 years ago

I agree that the problem has been fixed, but I am (apparently) not authorized to close the ticket.

comment:3 by Vladimir Prus, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.