git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] parse-options: abbreviation engine fix.

From
Pierre Habouzit <madcoder@debian.org>
Date
Nov 5, 2007, 12:59 UTC
Message-ID
<20071105125914.GD25574@artemis.corp>
In-Reply-To
<Pine.LNX.4.64.0711051230020.4362@racer.site>
On lun, nov 05, 2007 at 12:34:00 +0000, Johannes Schindelin wrote:
Show 20 quoted lines
> 
> When an option could be an ambiguous abbreviation of two options, the code 
> used to error out.  Even if an exact match would have occured later.
> 
> Test and original patch by Pierre Habouzit.
> 
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> ---
> 
> 	On Mon, 5 Nov 2007, Pierre Habouzit wrote:
> 
> 	> When we had at least two long option then followed by another 
> 	> one that was a prefix of both of them, then the abbreviation 
> 	> detector failed.
> 
> 	Yeah, I assumed that you would never do such a thing, but I agree 
> 	that with recursing option parsing it is much more likely.
> 
> 	It took me some time to understand your patch, and that the moving 
> 	of the UNSET handling was unnecessary.
  yeah, that's because I dislike where it's done. Each time I read it,
I'm under the impression that it clobbers p->opt if this case is not the
one used.
  In fact, I believe that for code clarity we should do what you
proposed earlier: disallow `=` in option names (that's rather sane
anyway) and drop the `rest` variable altogether, just use your current
arg_end and prefixcmp/strncmps. That will incidentally also allow to
remove skip_prefix while we're at it.
  This way we could set p->opt first thing in the function and be done
with it instead of doing it two different ways in the function, hence
making the reader assume one is wrong or at least questionable.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Johannes Schindelin
Message 17 of 17 in “proposal for an OPTION_SUBARRAY (recursive parser)”
  1. Pierre HabouzitNov 5, 2007
  2. 1/4 parse-options: abbreviation engine fix.Pierre Habouzit, Nov 5, 2007
  3. 2/4 Some better parse-options documentation.Pierre Habouzit, Nov 5, 2007
  4. 3/4 Add OPTION_BASEOFFSET/OPTION_SUBARRAY.Pierre Habouzit, Nov 5, 2007
  5. 4/4 Implement OPTION_SUBARRAY handling.Pierre Habouzit, Nov 5, 2007
  6. parse-options: abbreviation engine fix.Johannes Schindelin, Nov 5, 2007
  7. Johannes SchindelinNov 5, 2007
  8. 1/3 parse-options: abbreviation engine fix.Johannes Schindelin, Nov 5, 2007
  9. 2/3 parseopt: introduce OPT_RECURSE to specify shared optionsJohannes Schindelin, Nov 5, 2007
  10. Johannes SchindelinNov 5, 2007
  11. Linus TorvaldsNov 5, 2007
  12. Johannes SchindelinNov 5, 2007
  13. Pierre HabouzitNov 5, 2007
  14. Junio C HamanoNov 5, 2007
  15. Pierre HabouzitNov 5, 2007
  16. 3/3 parseopt: do not list options with the same name twiceJohannes Schindelin, Nov 5, 2007
  17. Pierre HabouzitNov 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.