<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">So I found what was causing the bug and have a fix, but I don’t really like it. Ideally we would do away with the hacky add+removal of quotes but that would take some additional time to find better solution.<div><br></div><div>The problem occurs when you have two options with the same argument value string as in:</div><div><br></div><div>type summary add Rectangle -s "Category1" -w Category1</div><div><br></div><div>As it iterates through the options, the first time it removes the quotes on the first “Catagory” string by searching through the m_args list to match the argument that was returned from OptionsParser::Parse. The problem arises when it searches for the next option value, it has already removed the quotes from the first “Category1” string so it matches again, then it checks if it was flagged for quote removal and removes the first character thinking it must be a quote. The problem is there is no direct matching between the string returned from the OptionsParser::Parse and the list of args so I added in a last_argv_iter variable to track which args we have already checked. This works ok but seems like it relies on the implementation of OptionsParser::Parse to always return options in order. A better way would be to remove all of the quote hackery but that will take some additional time to understand why it was added in the first place.</div><div><br></div><div><br></div><div>Here is the patch:</div><div><br></div><div><div><font face="Menlo" size="1" color="#0042aa">diff --git a/source/Interpreter/Args.cpp b/source/Interpreter/Args.cpp</font></div><div><font face="Menlo" size="1" color="#0042aa">index 682feb9..4dd7383 100644</font></div><div><font face="Menlo" size="1" color="#0042aa">--- a/source/Interpreter/Args.cpp</font></div><div><font face="Menlo" size="1" color="#0042aa">+++ b/source/Interpreter/Args.cpp</font></div><div><font face="Menlo" size="1" color="#0042aa">@@ -661,6 +661,9 @@ Args::ParseOptions (Options &options)</font></div><div><font face="Menlo" size="1" color="#0042aa"> }</font></div><div><font face="Menlo" size="1" color="#0042aa"> }</font></div><div><font face="Menlo" size="1" color="#0042aa"> </font></div><div><font face="Menlo" size="1" color="#0042aa">+ // Initialize the last argument iterator so we start checking at beginning of args list</font></div><div><font face="Menlo" size="1" color="#0042aa">+ int last_argv_iter = -1;</font></div><div><font face="Menlo" size="1" color="#0042aa">+</font></div><div><font face="Menlo" size="1" color="#0042aa"> while (1)</font></div><div><font face="Menlo" size="1" color="#0042aa"> {</font></div><div><font face="Menlo" size="1" color="#0042aa"> int long_options_index = -1;</font></div><div><font face="Menlo" size="1" color="#0042aa">@@ -717,6 +720,14 @@ Args::ParseOptions (Options &options)</font></div><div><font face="Menlo" size="1" color="#0042aa"> argv_iter = 0;</font></div><div><font face="Menlo" size="1" color="#0042aa"> for (auto args_iter = m_args.begin(); args_iter != m_args.end(); args_iter++, argv_iter++)</font></div><div><font face="Menlo" size="1" color="#0042aa"> {</font></div><div><font face="Menlo" size="1" color="#0042aa">+ // Skip any args we have already checked from previous options</font></div><div><font face="Menlo" size="1" color="#0042aa">+ if ( argv_iter <= last_argv_iter )</font></div><div><font face="Menlo" size="1" color="#0042aa">+ {</font></div><div><font face="Menlo" size="1" color="#0042aa">+ continue;</font></div><div><font face="Menlo" size="1" color="#0042aa">+ }</font></div><div><font face="Menlo" size="1" color="#0042aa">+ // Save the last argument we have checked</font></div><div><font face="Menlo" size="1" color="#0042aa">+ last_argv_iter = argv_iter;</font></div><div><font face="Menlo" size="1" color="#0042aa">+</font></div><div><font face="Menlo" size="1" color="#0042aa"> if (*args_iter == value && GetArgumentQuoteCharAtIndex(argv_iter) != '\0')</font></div><div><font face="Menlo" size="1" color="#0042aa"> {</font></div><div><font face="Menlo" size="1" color="#0042aa"> *args_iter = args_iter->substr(1);</font></div></div><div><br></div><div><br></div><div>So in the short term we can add this in as a temporary fix unless someone has objections and we can look for a better solution longer term.</div><div><br></div><div>- Alex Pepper</div></body></html>