Bugzilla – Bug 81
CommandLine::AddArgValue not working correctly
Last modified: 2007-10-10 10:20:13 UTC
./build/debug/samples/main-default-value --loops 1 You requested 10977 iterations of a loopiteration 0iteration 1iteration 2iteration 3iteration 4.... valgrind says: ==24210== Conditional jump or move depends on uninitialised value(s) ==24210== at 0x402B8C: main (main-default-value.cc:63) line 63 is: if(loops>0) Even though loops was initialized to zero at start, it sounds like CommandLine::Parse copied an undefined value over it.
This bug is just a bug about not reporting a more friendly error about invalid input.
(In reply to comment #1) > This bug is just a bug about not reporting a more friendly error about invalid > input. To me specific, what I mean is that the example command-line is erronous. It shows: ./build/debug/samples/main-default-value --loops 1 while it should show: ./build/debug/samples/main-default-value --loops=1 So, the problem is really that we do not detect an invalid syntax.
As usual, I didn't mean to make this a "blocker" bug; it is merely the default severity for newly created bugs...
Created attachment 74 [details] patch Patch to: 1. Support both --option=value and also --option value 2. Don't overwrite user variable with a undefined value when parsing fails 3. Give a warning when parsing of the value fails
The summary below sounds great > 1. Support both --option=value and also --option value > 2. Don't overwrite user variable with a undefined value when parsing fails > 3. Give a warning when parsing of the value fails It would be awesome if you could manage to add some tests which exercise these problems. If you can't, would you mind file another bug to keep track of the lack of tests for this code ?
Committed (with unit tests, and other minor tweaks)
(In reply to comment #3) > As usual, I didn't mean to make this a "blocker" bug; it is merely the default > severity for newly created bugs... > I changed the default severity to normal, and added default "All" for the platform and OS fields.