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

Re: [PATCH v2] Disallow empty section and variable names

From
LPLibor Pechacek <lpechacek@suse.cz>
Date
Jan 31, 2011, 09:17 UTC
Message-ID
<20110131091728.GB24297@fm.suse.cz>
In-Reply-To
<4D46694F.5070208@viscovery.net>
On Mon 31-01-11 08:48:31, Johannes Sixt wrote:
Show 18 quoted lines
> Am 1/30/2011 21:34, schrieb Libor Pechacek:
> > It is possible to break your repository config by creating an invalid key.  The
> > config parser in turn chokes on it.
> > 
> > $ git init
> > Initialized empty Git repository in /tmp/gittest/.git/
> > $ git config .foo false
> > $ git config .foo
> > fatal: bad config file line 6 in .git/config
> 
> Just a nit: Your example is misleading because it "only" shows that if you
> shove in junk, and ask for junk, you get breakage. However, the breakage
> is much more serious, and you could have demonstrated it, if you had
> written your example like this:
> 
> $ git config .foo false
> $ git config user.email
> fatal: bad config file line 6 in .git/config
Yes, that one is more persuasive.  Thanks for hint.
Show 8 quoted lines
> > +	test_must_fail git config . &&
> > +	test_must_fail git config .foo &&
> > +	test_must_fail git config foo. &&
> > +	test_must_fail git config .foo. &&
> 
> Not a nit: These tests only show that 'git config' cannot be asked for
> junk, but they do not show that you cannot insert junk into the config
> file anymore using 'git config'.

This change builds on top of "Sanity-check config variable names" which makes setting and getting values use the same key checking routine. For the moment, it does not matter if we test the "set" ot "get" path.

Yet, I accept the get/set operations can use different key checking routine in the future (although I can't imagine the reson for it), and overall testing the "set" path is in line with the idea of the patch.

Thanks for input, I'll send updated patch.
Libor
-- 
Libor Pechacek
SUSE L3 Team, Prague
Previous: Johannes SixtNext: Johannes Sixt
Message 4 of 9 in “Disallow empty section and variable names”
  1. Disallow empty section and variable namesLibor Pechacek, Jan 27, 2011
  2. Disallow empty section and variable namesLibor Pechacek, Jan 30, 2011
  3. Johannes SixtJan 31, 2011
  4. Libor PechacekJan 31, 2011
  5. Johannes SixtJan 31, 2011
  6. Disallow empty section and variable namesLibor Pechacek, Jan 31, 2011
  7. Jens LehmannJan 31, 2011
  8. Disallow empty section and variable namesLibor Pechacek, Feb 1, 2011
  9. Junio C HamanoFeb 10, 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.