git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCHv2] gitweb: Git config keys are case insensitive, make config search too
Date: Thu, 28 Jul 2011 13:14:24 -0700	[thread overview]
Message-ID: <7vtya6kvrz.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110727205118.10439.58875.stgit@localhost.localdomain> (Jakub Narebski's message of "Wed, 27 Jul 2011 22:53:33 +0200")

Jakub Narebski <jnareb@gmail.com> writes:

> "git config -z -l" that gitweb uses in git_parse_project_config() to
> populate %config hash returns section and key names of config
> variables in lowercase (they are case insensitive).  When checking
> %config in git_get_project_config() we have to take it into account.
>
> Gitweb does not (yet?) use git config variables with subsection, so we
> can simply lowercase $key in git_get_project_config (only subsection
> names are case sensitive).

Why stop there, I have to wonder, instead of futureproofing with minimum
cost, even with something naïve like:

	if (my ($hi, $mi, $lo) = ($key =~ /^([^.]*)\.(.*)\.(.*)$)) {
		$key = join(".", lc($hi), $mi, lc($lo);
	} else {
        	$key = lc($key);
	}

> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> I think it is a resend, but I haven't found first version.
>
> The patch is unchanged, but commit message got improved.
> It is not as much bugfix as hardening (against user e.g. adding
> new overridable feature via gitweb config file).
>
>  gitweb/gitweb.perl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 1070805..90b5a73 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2526,6 +2526,7 @@ sub git_get_project_config {
>  
>  	# key sanity check
>  	return unless ($key);
> +	$key = lc($key); # assuming there is no subsection
>  	$key =~ s/^gitweb\.//;
>  	return if ($key =~ m/\W/);
>  

  reply	other threads:[~2011-07-28 20:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 20:53 [PATCHv2] gitweb: Git config keys are case insensitive, make config search too Jakub Narebski
2011-07-28 20:14 ` Junio C Hamano [this message]
2011-07-28 21:38   ` [PATCHv3] " Jakub Narebski

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=7vtya6kvrz.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.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).