Boost program_options zero_tokens broken

Bug #636230 reported by Andrew Hutchings
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Critical
Andrew Hutchings
7.0
Fix Released
Critical
Andrew Hutchings

Bug Description

Boost's program_options zero_tokens has a know bug (https://svn.boost.org/trac/boost/ticket/1132)

Basically it means for boolean you cannot give any parameters. Which is fine if the boolean default is false, but if the default is true you have no way to set it to false when zero_tokens is used.

This has effectively broken many options.

Related branches

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

I'll work on an urgent fix for this later today.

Revision history for this message
Vijay Samuel (vjsamuel) wrote : Re: [Bug 636230] Re: Boost program_options zero_tokens broken

Hi,
  I ve already fixed some boolean options in embedded innodb which had this
problem. I could probably fix all the remaining boolean type options as well
if this bug is assigned to me.

Cheers,
-Vijay

On Sep 12, 2010 2:05 PM, "Andrew Hutchings" <email address hidden>
wrote:

I'll work on an urgent fix for this later today.

** Changed in: drizzle/elliott
      Status: New => Confirmed

--
Boost program_options zero_tokens broken
https://bugs.launchpad.net/bugs/636230
You received th...

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

its ok Vijay, I have already pushed a branch with it which is running through param-build now. The urgency is mostly down to the release due tomorrow.

Revision history for this message
Vijay Samuel (vjsamuel) wrote :

Nice fix. Did you go through the entire code base? There are instances in most of the plugins that fail with respect to boolean type options with zero tokens.

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

Explanation of fix:

OK, so, first I used vj's method of zero_tokens()->multitoken(). This allows 0 or 1 token. The problem with this is if you do something like:

drizzle --boolean-option=true test

Where test is the test database. It would think this is a second token to the boolean option or fail.

The fix I have committed instead uses:

implicit_value(true)

So when --boolean-option is given without a =true or =false it will set it to true without the downside of zero_tokens()->multitoken().

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

"It would think this is a second token to the boolean option or fail." <- I of course mean 'and fail'

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

unfortunately new fix is broken with exactly the same problem

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

going to re-write and merge as part of Monty's PO work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.