git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
	Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH v2] config: reject invalid VAR in 'git -c VAR=VAL command'
Date: Wed, 22 Feb 2017 23:19:44 -0800	[thread overview]
Message-ID: <xmqqo9xt8jcf.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170223055831.u3yofkby3c56t7l4@sigill.intra.peff.net> (Jeff King's message of "Thu, 23 Feb 2017 00:58:31 -0500")

Jeff King <peff@peff.net> writes:

> FWIW, the code looks OK here. It is a shame to duplicate the policy
> found in git_config_parse_key(), though.
>
> I wonder if we could make a master version of that which canonicalizes
> in-place, and then just wrap it for the git_config_parse_key()
> interface. Actually, I guess the function you just wrote _is_ that inner
> function, as long as it learned about the "quiet" flag.

Hmm, I obviously missed an opportunity.  I thought about doing a
similar thing with the policy in parse-source, but that side didn't
seem worth doing, as the config-parse-source callgraph is quite a
mess (as it has to parse the .ini like format with line breaks and
comments, not the simple "<string>[.<string>].<string>" thing, it
cannot quite avoid it), and it needs to take advantage of _some_
policy to parse the pieces.

We could loosen the policy implemented by config-parse-key interface
(e.g. change config-parse-source to let anything that begins with a
non-whitespace continue to be processed with get_value(), instead of
only allowing string that begins with isalpha(); similarly loosen
get_value() to allow any non-dot non-space string, not just
iskeychar() bytes) and first turn what is read into the simple
"<string>[.<string>].<string>" format, and then reuse the new
"master" logic to validate.  That would allow us to update the
"master" logic to make it tighter or looser to some degree, but the
source parser still needs to hardcode _some_ policy (e.g. the first
level and the last level names begin with a non-space) that allows
it to guess what "<string>" pieces the contents being parsed from
the .ini looking format meant to express.

But you are right.  config-parse-key does have the simpler string
that can just be given to the canonicalize thing and we should be
able to reuse it.




  reply	other threads:[~2017-02-23  7:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 11:17 [BUG] submodule config does not apply to upper case submodules? Lars Schneider
2017-02-15 11:33 ` [PATCH v1] t7400: cleanup "submodule add clone shallow submodule" test Lars Schneider
2017-02-15 18:29   ` Stefan Beller
2017-02-15 18:39   ` Junio C Hamano
2017-02-15 18:14 ` [BUG] submodule config does not apply to upper case submodules? Stefan Beller
2017-02-15 18:53 ` Junio C Hamano
2017-02-15 22:54   ` Jonathan Tan
2017-02-15 23:02     ` Junio C Hamano
2017-02-15 23:11       ` Junio C Hamano
2017-02-15 23:28         ` Stefan Beller
2017-02-15 23:37           ` Junio C Hamano
2017-02-15 23:43             ` Stefan Beller
2017-02-15 23:53               ` Junio C Hamano
2017-02-16 23:22             ` Jeff King
2017-02-15 23:33         ` Jonathan Tan
2017-02-16 18:49           ` Junio C Hamano
2017-02-15 23:48         ` [PATCH] config: preserve <subsection> case for one-shot config on the command line Junio C Hamano
2017-02-16 10:30           ` Lars Schneider
2017-02-16 16:59             ` Junio C Hamano
2017-02-16 23:27             ` Jeff King
2017-02-17  1:25               ` Junio C Hamano
2017-02-20  9:58                 ` Junio C Hamano
2017-02-20 17:17                   ` Lars Schneider
2017-02-21  7:38                   ` Jeff King
2017-02-21 17:01                     ` Junio C Hamano
2017-02-21 17:17                       ` [PATCH v2] " Junio C Hamano
2017-02-21 17:50                         ` Jeff King
2017-02-21 17:57                           ` Stefan Beller
2017-02-21 18:53                   ` [PATCH] config: reject invalid VAR in 'git -c VAR=VAL command' Junio C Hamano
2017-02-21 19:15                     ` Stefan Beller
2017-02-21 20:33                       ` Junio C Hamano
2017-02-21 21:24                         ` [PATCH v2] " Junio C Hamano
2017-02-22  1:06                           ` Junio C Hamano
2017-02-23  5:58                           ` Jeff King
2017-02-23  7:19                             ` Junio C Hamano [this message]
2017-02-23 23:19                               ` Junio C Hamano
2017-02-24  0:41                                 ` Jeff King
2017-02-24  4:17                                   ` Junio C Hamano
2017-02-24  4:22                                     ` Jeff King
2017-02-24  6:08                                       ` Junio C Hamano
2017-02-24  6:10                                         ` Jeff King

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=xmqqo9xt8jcf.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sbeller@google.com \
    /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).