From: Junio C Hamano <gitster@pobox.com>
To: Ben Walton <bdwalton@gmail.com>
Cc: hagger@alum.mit.edu, git@vger.kernel.org
Subject: Re: [PATCH] Remove the hard coded length limit on variable names in config files
Date: Mon, 01 Oct 2012 12:33:02 -0700 [thread overview]
Message-ID: <7vvceuasy9.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1349034276-10690-1-git-send-email-bdwalton@gmail.com> (Ben Walton's message of "Sun, 30 Sep 2012 20:44:36 +0100")
Ben Walton <bdwalton@gmail.com> writes:
> 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.
next prev parent reply other threads:[~2012-10-01 19:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 0:47 [PATCH] Prevent git-config from storing section keys that are too long Ben Walton
2012-09-07 1:33 ` Junio C Hamano
2012-09-07 2:34 ` Ben Walton
2012-09-29 10:19 ` [PATCH] Remove the hard coded length limit on variable names in config files Ben Walton
2012-09-30 4:05 ` Michael Haggerty
2012-09-30 18:20 ` Ben Walton
2012-09-30 19:44 ` Ben Walton
2012-10-01 19:33 ` Junio C Hamano [this message]
2012-10-01 3:16 ` Michael Haggerty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vvceuasy9.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bdwalton@gmail.com \
--cc=git@vger.kernel.org \
--cc=hagger@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).