Boost C++ Libraries: Ticket #689: [program_options] Endless loop with long default arguments https://svn.boost.org/trac10/ticket/689 <pre class="wiki">when using a po::value with a representation of the default value having a certain length, 'std::cout &lt;&lt; opts' will stuck in an endless loop. E.g. ----- #include &lt;boost/program_options.hpp&gt; #include &lt;string&gt; #include &lt;iostream&gt; namespace po = boost::program_options; int main(int argc, char *argv[]) { po::options_description opts; opts.add_options() ("cfgfile,c", po::value&lt;std::string&gt;()-&gt;default_value("/usr/local/etc/myprogramXXXXXXXXX/configuration.conf"), "the configfile"); std::cout &lt;&lt; opts; } ----- | $ rpm -q boost | boost-1.33.1-5 | | $ g++ foo.c -lboost_program_options | $ strace ./a.out | ... | write(1, " -c [ --cfgfile ] arg (=/usr/lo"..., 80 -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXXX/configuration.conf) | ) = 80 | write(1, " "..., 80 | ) = 80 | write(1, " "..., 80 | ) = 80 | ... Removing one 'X' will result in an ugly | -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXX/configuration.conf) t | h | e | c | o | n | f | i | g | f | i | l | e output. It would be nice, when: - the default value could be moved into the description column - the description would begin on a new line and an earlier column (e.g. 30-40) when option name/default-value are too long (&gt; 30-40 chars) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/689 Trac 1.4.3 nobody Sun, 25 Mar 2007 20:30:18 GMT <link>https://svn.boost.org/trac10/ticket/689#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/689#comment:1</guid> <description> <pre class="wiki">Logged In: NO Hit this one as well. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Daryle Walker</dc:creator> <pubDate>Fri, 03 Aug 2007 12:11:51 GMT</pubDate> <title>component changed; severity set https://svn.boost.org/trac10/ticket/689#comment:2 https://svn.boost.org/trac10/ticket/689#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">program_options</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket s.ochsenknecht@… Mon, 19 Oct 2009 18:08:48 GMT attachment set https://svn.boost.org/trac10/ticket/689 https://svn.boost.org/trac10/ticket/689 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patch1.diff</span> </li> </ul> <p> patch </p> Ticket s.ochsenknecht@… Mon, 19 Oct 2009 18:12:58 GMT <link>https://svn.boost.org/trac10/ticket/689#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/689#comment:3</guid> <description> <p> I added a patch which solves this ticket. </p> <p> When printing out all program options it will go to a new line and print out the description on the next line if the first part is too long. The output from the test case will look like the following with the patch: </p> <pre class="wiki"> -c [ --cfgfile ] arg (=/usr/local/etc/myprogramXXXXXXXX/configuration.conf) the configfile -f [ --fritz ] arg (=/other/file) the output file </pre><p> Is it useful? Any comments? </p> <p> I'm not a boost maintainer, so I'll better to keep the status of this ticket ... :-) </p> </description> <category>Ticket</category> </item> <item> <author>Sascha Ochsenknecht <s.ochsenknecht@…></author> <pubDate>Tue, 20 Oct 2009 13:40:44 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/689#comment:4 https://svn.boost.org/trac10/ticket/689#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">s.ochsenknecht@…</span> added </li> </ul> Ticket Vladimir Prus Sun, 01 Nov 2009 10:44:50 GMT status, resolution changed https://svn.boost.org/trac10/ticket/689#comment:5 https://svn.boost.org/trac10/ticket/689#comment:5 <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> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57271" title="Put description to next line if we'd overflow otherwise. Fixes #689. ...">[57271]</a>) Put description to next line if we'd overflow otherwise. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/689" title="#689: Bugs: [program_options] Endless loop with long default arguments (closed: fixed)">#689</a>. </p> <p> Patch from Sascha Ochsenknecht. </p> Ticket Vladimir Prus Sun, 01 Nov 2009 10:46:20 GMT <link>https://svn.boost.org/trac10/ticket/689#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/689#comment:6</guid> <description> <p> Sascha, I have applied your patch. I have also added a testcase. Note that your patch had a few formatting changes, which I've left out in order not to mix semantic and formatting changes in one commit. </p> <p> Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Sascha Ochsenknecht</dc:creator> <pubDate>Sun, 06 Dec 2009 12:18:14 GMT</pubDate> <title>milestone set https://svn.boost.org/trac10/ticket/689#comment:7 https://svn.boost.org/trac10/ticket/689#comment:7 <ul> <li><strong>milestone</strong> → <span class="trac-field-new">Boost 1.42.0</span> </li> </ul> Ticket