Re: [bug] generic issue with git_config handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christian Couder schrieb:
> Le jeudi 31 janvier 2008, Pierre Habouzit a écrit :
>> On Thu, Jan 31, 2008 at 09:25:32AM +0000, Junio C Hamano wrote:
>>> Pierre Habouzit <madcoder@xxxxxxxxxx> writes:
>>>>   One of my co-workers stumbled upon a misfeature of the git config
>>>> parser. The following syntax is allowed:
>>>>
>>>>     [section]
>>>> 	 foo
>>> Yeah, that is how "truth" value of boolean is spelled.
>>>
>>>> [user]
>>>>     name
>>> That's very unfortunate.  Whatever is expecting string value
>>> should check for NULL.  Fix should probably be easy enough for
>>> any git-hacker-wannabe to tackle ;-)
>>   I think so too, though my count is something like 40 functions to
>> investigate (the 40 handlers) and where it recurses into ;) Too much
>> work for the time I have right now.
> 
> I would suggest this patch:
> 
> ---8<---
> diff --git a/config.c b/config.c
> index 526a3f4..92613c5 100644
> --- a/config.c
> +++ b/config.c
> @@ -139,7 +139,7 @@ static int get_value(config_fn_t fn, char *name, 
> unsigned in
>                 if (!value)
>                         return -1;
>         }
> -       return fn(name, value);
> +       return fn(name, value ? value : "");
>  }

You can't. The reason is that get_config_bool() treats value == NULL and
*value == '\0' differently. *That's* the most unfortunate part of it. :-(

-- Hannes
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux