From 22ea087c17edc3a705586f06bd599bec98f66293 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 21 May 2021 20:10:38 +0800 Subject: [PATCH] crimson/osd: disable allow_guessing when parsing command line options we pass "--id " to ceph-osd for specifying the osd id, but seastar app template also provides an option of "--idle-poll-time-us arg". boost::program_option::command_line_parser() uses default_style when parsing options. and default_style includes allow_guessing, which in turn matches partial option as well, so "--id" matches with "--idle" when we are trying to figure out which options are consumed by seastar app template, and which are not. see https://www.boost.org/doc/libs/1_76_0/doc/html/boost/program_options/command_line_style/style_t.html so, in this change, stype is specified explicitly, and "allow_guessing" is removed from the "default_style" before being passed to style(), so that only the full option name are matched. Signed-off-by: Kefu Chai --- src/crimson/osd/main.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 04f8ca7cf3363..78eed27ab550c 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -37,7 +37,10 @@ auto partition_args(seastar::app_template& app, char** argv_begin, char** argv_e // collect all options consumed by seastar::app_template auto parsed = bpo::command_line_parser(std::distance(argv_begin, argv_end), argv_begin) - .options(app.get_options_description()).allow_unregistered().run(); + .options(app.get_options_description()) + .style(bpo::command_line_style::default_style & + ~bpo::command_line_style::allow_guessing) + .allow_unregistered().run(); auto unknown_args = bpo::collect_unrecognized(parsed.options, bpo::include_positional); std::vector ceph_args, app_args; -- 2.47.3