boostorg / boostorg/program_options

crash with one dash

Offen
#123 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
136
Forks
117
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
#include
#include
using namespace std;

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

const map 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(¯os), 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](https://user-images.githubusercontent.com/48535920/230930473-cfa65ee5-d1f6-4d41-8853-ec1cd6405a7b.gif)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne damit, den bereitgestellten C++-Reproducer mit der Option mit einfachem Bindestrich zu kompilieren und auszuführen, um den Absturz zu bestätigen. Verfolge dann den Einstiegspunkt für die Befehlszeilenanalyse und vergleiche das Verhalten mit der dokumentierten Optionssyntax; fertig ist die Aufgabe, wenn der Absturz behoben ist und der Fall mit einfachem Bindestrich einen Regressionstest hat.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
cli
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.