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

Re: [PATCHv2] gitweb: Git config keys are case insensitive, make config search too

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 28, 2011, 20:14 UTC
Message-ID
<7vtya6kvrz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110727205118.10439.58875.stgit@localhost.localdomain>
Jakub Narebski <jnareb@gmail.com> writes:
Show 8 quoted lines
> "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);
	}
Show 23 quoted lines
> 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/);
>  
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 3 in “[PATCHv2] gitweb: Git config keys are case insensitive, make config search too”
  1. Jakub NarebskiJul 27, 2011
  2. Junio C HamanoJul 28, 2011
  3. [PATCHv3] gitweb: Git config keys are case insensitive, make config search tooJakub Narebski, Jul 28, 2011

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.