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

Re: [PATCH] guard config parser from value=NULL

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Feb 10, 2008, 17:08 UTC
Message-ID
<20080210170820.GA12162@auto.tuwien.ac.at>
In-Reply-To
<7vhcghet3q.fsf@gitster.siamese.dyndns.org>
On Sat, Feb 09, 2008 at 01:07:53PM -0800, Junio C Hamano wrote:
Show 25 quoted lines
> Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
> 
> > @@ -416,7 +416,7 @@ int git_default_config(const char *var, const char *value)
> >  		return 0;
> >  	}
> >  
> > -	if (!strcmp(var, "user.name")) {
> > +	if (value && !strcmp(var, "user.name")) {
> >  		strlcpy(git_default_name, value, sizeof(git_default_name));
> >  		return 0;
> >  	}
> 
> This is wrong, isn't it?  When somebody says
> 
> 	[user]
>         	name
> 
> we should not silently ignore it, but instead say "user.name is
> not a bool!" and error out.
> 
> The same comment applies to all other
> 
> 	if (value && !strcmp(var, "<varname>"))
> 
> conversions.
For all in config.c, yes.

For setup.c, I would say no. The code is called, when trying to find a git repository.

I have seen, that a similar patch for the config.c stuff has been posted. I will wait some days to see, what happens with it.

mfg Martin Kögler
Previous: Junio C Hamano
Message 3 of 3 in “guard config parser from value=NULL”
  1. guard config parser from value=NULLMartin Koegler, Feb 9, 2008
  2. Junio C HamanoFeb 9, 2008
  3. Martin KoeglerFeb 10, 2008

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.