Re: [PATCH v2 04/21] kconfig: reference environments directly and remove 'option env=' syntax

From: Masahiro Yamada
Date: Fri Mar 30 2018 - 01:32:01 EST


2018-03-29 11:19 GMT+09:00 Ulf Magnusson <ulfalizer@xxxxxxxxx>:.

>> %%
>> +static void expand_string(const char *in)
>> +{
>> + char *p, *q;
>> +
>> + p = expand_string_value(in);
>> +
>> + q = p + strlen(p);
>> + while (q > p)
>> + unput(*--q);
>> +
>> + free(p);
>> +}
>> +
>
> I like the simplicity of this approach, but I suspect it might be too simple.
>
> For example, the following breaks with a syntax error if $ENV has any
> double quotes in its value:
>
> config FOO
> string "foo"
> default "$ENV"
>
> The following will only work as expected if $ENV expands to a valid
> Kconfig symbol name. If it doesn't, random stuff will happen (most
> likely a syntax error).
>
> config FOO
> string "foo"
> default $ENV
>
> The reason it works if $ENV expands to a valid symbol name is that
> undefined symbols get their name as their (string) value. If the
> symbol happens to be defined, it will be referenced, which seems
> confusing too.
>
> In general, that reinterpretation of expanded values feels a bit icky
> to me, and as something that might add complexity to Kconfig for
> little value. If $ENV outside of quotes absolutely must be supported,
> I think it should be a shorthand for "$ENV" (which means "constant
> value" in Kconfig speak).
>

You are right. This implementation is too lazy, and bad.
I will change the implementation.

Thanks.




--
Best Regards
Masahiro Yamada