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

Re: [PATCH] Remove the hard coded length limit on variable names in config files

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 1, 2012, 19:33 UTC
Message-ID
<7vvceuasy9.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1349034276-10690-1-git-send-email-bdwalton@gmail.com>
Ben Walton <bdwalton@gmail.com> writes:
Show 25 quoted lines
> Previously while reading the variable names in config files, there was
> a 256 character limit with at most 128 of those characters being used
> by the section header portion of the variable name.  This limitation
> was only enforced while reading the config files.  It was possible to
> write a config file that was not subsequently readable.
>
> Instead of enforcing this limitation for both reading and writing,
> remove it entirely by changing the var member of the config_file
> struct to a strbuf instead of a fixed length buffer.  Update all of
> the parsing functions in config.c to use the strbuf instead of the
> static buffer.
>
> The parsing functions that returned the base length of the variable
> name now return simply 0 for success and -1 for failure.  The base
> length information is obtained through the strbuf's len member.
>
> We now send the buf member of the strbuf to external callback
> functions to preserve the external api.  None of the external callers
> rely on the old size limitation for sizing their own buffers so
> removing the limit should have no externally visible effect.
>
> Signed-off-by: Ben Walton <bdwalton@gmail.com>
> ---
>  config.c |   59 +++++++++++++++++++++++++++++------------------------------
>  1 file changed, 29 insertions(+), 30 deletions(-)
Makes sense, and I found the patch very readable.
Thanks, both.
Previous: Ben WaltonNext: Michael Haggerty
Message 8 of 9 in “Prevent git-config from storing section keys that are too long”
  1. Prevent git-config from storing section keys that are too longBen Walton, Sep 7, 2012
  2. Junio C HamanoSep 7, 2012
  3. Ben WaltonSep 7, 2012
  4. Remove the hard coded length limit on variable names in config filesBen Walton, Sep 29, 2012
  5. Michael HaggertySep 30, 2012
  6. Ben WaltonSep 30, 2012
  7. Remove the hard coded length limit on variable names in config filesBen Walton, Sep 30, 2012
  8. Junio C HamanoOct 1, 2012
  9. Michael HaggertyOct 1, 2012

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.