Opened 13 years ago

Closed 13 years ago

#3361 closed Bugs (invalid)

[Program Options] Bug: empty arguments treated as positional ones

Reported by: k-r.ernst@… Owned by: Vladimir Prus
Milestone: Boost 1.40.0 Component: program_options
Version: Boost 1.39.0 Severity: Problem
Keywords: program options whitespace positional Cc:

Description

Tested with boost::program_options in 1.39

When an program argument is empty, or contains only whitespace, it it treated as positional argument, confusing program_options

How to reproduce:

  1. Get example app which expects 1 positional argument
  1. launch it with e.g. execlp("testapp", "testapp", "", "real_positional_argument", NULL);

Observed behavior: Error: "too many positional options"

Expected behavior: Empty argument should be ignored

Additional note: instead of empty string "", the same error happens with only whitespace like " "

Change History (2)

comment:1 by Vladimir Prus, 13 years ago

Could you provide a rationale for ignoring tokens that are either empty strings or whitespace-only? Why are such tokens are passed to the program in the first place? What other programs ignore such tokens?

comment:2 by Vladimir Prus, 13 years ago

Resolution: invalid
Status: newclosed

Since you did not provide any rationale, I am closing this bug. Of course, should you wish to follow up, please reopen it.

Note: See TracTickets for help on using tickets.