[Buildroot] [PATCH 1/1] fix failure during 'make linux-menuconfig' when PATH env var has spaces

Dan Raymond draymond at foxvalley.net
Wed Mar 3 18:18:14 UTC 2021


On 3/3/2021 10:37 AM, Dan Raymond wrote:
> On 3/3/2021 10:11 AM, Arnout Vandecappelle wrote:
>
>>   Hi Dan,
>>
>> On 01/03/2021 03:40, Dan Raymond wrote:
>>>   $(2)_CONFIGURATOR_MAKE_ENV = \
>>> -    $$(filter-out PATH=% PKG_CONFIG=% PKG_CONFIG_SYSROOT_DIR=% \
>>> -       PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=% 
>>> PKG_CONFIG_ALLOW_SYSTEM_LIBS=% \
>>> -       PKG_CONFIG_LIBDIR=%,$$($(2)_MAKE_ENV)) \
>>> +    $$(call strip_env,PATH PKG_CONFIG PKG_CONFIG_SYSROOT_DIR \
>>> +       PKG_CONFIG_ALLOW_SYSTEM_CFLAGS PKG_CONFIG_ALLOW_SYSTEM_LIBS \
>>> +       PKG_CONFIG_LIBDIR,$$($(2)_MAKE_ENV)) \
>>>       PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)"
>> This is a bit of half-hearted quoting. It happens to work for spaces, 
>> but
>> breaks down on double quotes, backslashes, dollar signs, and probably 
>> others as
>> well.
>>
>>   I don't like to solve one specific corner case but leaving the door 
>> wide open
>> for different ones...
>>
>>   Unfortunately, proper shell quoting is really really hard.
>>
>>   Therefore, I'd propose to skirt around the issue entirely by 
>> overriding the
>> environment variables directly. Something like this (untested):
>>
>> $(2)_CONFIGURATOR_MAKE_ENV = \
>>     $$($(2)_MAKE_ENV) \
>>     PATH="$$(BR_PATH)" \
>>     PKG_CONFIG= \
>>     ...
>
> I like your idea.  It is much simpler.  I'll prepare a new patch and 
> test it.  But why are you setting PATH="$$(BR_PATH)"? Previously the 
> PATH variable was stripped entirely.

OK, I see why we can't just set an empty path (none of the build tools 
will be found).  I got the following to work.  You can't quote 
$(BR_PATH) because it is already quoted and you only need one $.

$(2)_CONFIGURATOR_MAKE_ENV = \
     $$($(2)_MAKE_ENV) \
     PATH=$(BR_PATH) \
     PKG_CONFIG= \
     PKG_CONFIG_SYSROOT_DIR= \
     PKG_CONFIG_ALLOW_SYSTEM_CFLAGS= \
     PKG_CONFIG_ALLOW_SYSTEM_LIBS= \
     PKG_CONFIG_LIBDIR= \
     PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)"

However the result is equivalent to leaving the PATH alone:

$(2)_CONFIGURATOR_MAKE_ENV = \
     $$($(2)_MAKE_ENV) \
     PKG_CONFIG= \
     PKG_CONFIG_SYSROOT_DIR= \
     PKG_CONFIG_ALLOW_SYSTEM_CFLAGS= \
     PKG_CONFIG_ALLOW_SYSTEM_LIBS= \
     PKG_CONFIG_LIBDIR= \
     PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)"



More information about the buildroot mailing list