Boost C++ Libraries: Ticket #898: [program_options] improper guess https://svn.boost.org/trac10/ticket/898 <pre class="wiki">I found a problem in the program_options when using the allow_guessing style (which is the default). The option_description::match() function (boost_1_33_1/libs/program_options/src/options_description.cpp) checks option names approximatively only if the allow_guessing is turned on. The match() function needs to return three values: definitively not this option, definitively this option or maybe this option. In the first case, you try the next option (see options_description::find_nothrow() in the same file). In the second case, you return with that very option. In the third case, you try the next options. If at the very end, you did not find a definitive option and you found more than 2 matching approximetly, then you generate the error (more than one approx. matched!). And if nothing matched, you generate that other error. This is only partially fixed in Debian and I'm attaching that fix below. The problem in the Debian fix is that if the valid full definitive option is to be found AFTER two other partial options, it also breaks (duh! am I the only one to understand this logic?! it seems so simple!) I did not understand the 1.34.0 yet and thus I did not see the fix there... </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/898 Trac 1.4.3 alexis_wilke Tue, 17 Apr 2007 07:25:43 GMT <link>https://svn.boost.org/trac10/ticket/898#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/898#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=554061 Originator: YES Okay! I got it! You have tons of fixes in your CVS and no new tarball for years... Argh! To finish up the fix, change the following: if (found != -1) { vector&lt;string&gt; alts; // FIXME: the use of 'key' here might not // be the best approach. alts.push_back(m_options[found]-&gt;key(name)); alts.push_back(m_options[i]-&gt;key(name)); boost::throw_exception(ambiguous_option(name, alts)); } else { found = i; } with this: if(found != -1) found = -2; else found = i; then right after the loop: if(found == -2) throw ... That lets people enter their options in whatever order (especially if they have multiple tables of options like me!) Thank you. Note: I'm removing the attachment since that's what's in the CVS: http://boost.cvs.sourceforge.net/boost/boost/libs/program_options/src/options_description.cpp?revision=1.16.2.3&amp;view=markup </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Wed, 11 Jul 2007 19:08:15 GMT</pubDate> <title>status, resolution changed; severity set https://svn.boost.org/trac10/ticket/898#comment:2 https://svn.boost.org/trac10/ticket/898#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fixed</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Showstopper</span> </li> </ul> <p> Fixed in CVS HEAD. I've used slightly different code solution, but thanks for the patch anyway! </p> Ticket