crash with one dash

Open
#123 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
cli

Research direction

Start by compiling and running the supplied C++ reproducer with the single-dash option to confirm the crash. Then trace the command-line parsing entry point and compare the behavior with the documented option syntax; done means the crash is addressed and the single-dash case has a regression test.

Written by the indexing model from the issue text.

Description

please see attached GIF demonstrate crash with one dash i.e. to wit if an option is introduced w/ one dash instead of two exception is thrown . below is code executed .

#include <boost\program_options.hpp>
#include <map>
#include <string>
using namespace std;

const string option_flag = "O";
const string option_flag_description = string("an option");

const map<string , string> options__description_map = {
	{option_flag, option_flag_description},
};

int main(int argc, const char* argv[], const char* envp[])
{
	boost::program_options::variables_map vm;
	string macros;
	boost::program_options::options_description options_description("bugyCode options");
	options_description.add_options()
		(option_flag.c_str(), boost::program_options::value<string>(&macros), option_flag_description.c_str());

	boost::program_options::store(boost::program_options::parse_command_line(argc, argv, options_description), vm);
	boost::program_options::notify(vm);
	return 0;
}

crash with one dash demonstration

Dominant language
C++
Stars
136
Forks
117
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/program_options

All issues in boostorg/program_options

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.