diff mbox series

package/pkg-utils: refine KCONFIG_MUNGE_DOT_CONFIG

Message ID 20220727140822.355859-1-tianyuanhao3@163.com
State Accepted
Headers show
Series package/pkg-utils: refine KCONFIG_MUNGE_DOT_CONFIG | expand

Commit Message

TIAN Yuanhao July 27, 2022, 2:08 p.m. UTC
Given a .config with:

    FOO="1234"
    BAR="$(FOO)"

and then:

    $(call KCONFIG_SET_OPT,FOO,azerty)

would yield a .config with just:

    FOO="azerty"

because \<FOO\> would match the assignment to BAR.

Reported-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

---

I found something similar in uClibc-ng:

    TARGET_ARCH="x86_64"
    RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/"
---
 package/pkg-utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yann E. MORIN July 27, 2022, 3:30 p.m. UTC | #1
Yuanhao, All,

On 2022-07-27 07:08 -0700, TIAN Yuanhao spake thusly:
> Given a .config with:
> 
>     FOO="1234"
>     BAR="$(FOO)"
> 
> and then:
> 
>     $(call KCONFIG_SET_OPT,FOO,azerty)
> 
> would yield a .config with just:
> 
>     FOO="azerty"
> 
> because \<FOO\> would match the assignment to BAR.
> 
> Reported-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> 
> I found something similar in uClibc-ng:
> 
>     TARGET_ARCH="x86_64"
>     RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/"
> ---
>  package/pkg-utils.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index e5dba2add0..6ece27baa2 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -22,7 +22,7 @@ KCONFIG_DOT_CONFIG = $(strip \
>  
>  # KCONFIG_MUNGE_DOT_CONFIG (option, newline [, file])
>  define KCONFIG_MUNGE_DOT_CONFIG
> -	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(3)) && \
> +	$(SED) '/^\(# \)\?$(strip $(1))\>/d' $(call KCONFIG_DOT_CONFIG,$(3)) && \
>  	echo '$(strip $(2))' >> $(call KCONFIG_DOT_CONFIG,$(3))
>  endef
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Peter Korsgaard Aug. 30, 2022, 4:14 p.m. UTC | #2
>>>>> "TIAN" == TIAN Yuanhao <tianyuanhao3@163.com> writes:

 > Given a .config with:
 >     FOO="1234"
 >     BAR="$(FOO)"

 > and then:

 >     $(call KCONFIG_SET_OPT,FOO,azerty)

 > would yield a .config with just:

 >     FOO="azerty"

 > because \<FOO\> would match the assignment to BAR.

 > Reported-by: Yann E. MORIN <yann.morin.1998@free.fr>
 > Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
 > Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Committed to 2022.05.x and 2022.02.x, thanks.
diff mbox series

Patch

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index e5dba2add0..6ece27baa2 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -22,7 +22,7 @@  KCONFIG_DOT_CONFIG = $(strip \
 
 # KCONFIG_MUNGE_DOT_CONFIG (option, newline [, file])
 define KCONFIG_MUNGE_DOT_CONFIG
-	$(SED) "/\\<$(strip $(1))\\>/d" $(call KCONFIG_DOT_CONFIG,$(3)) && \
+	$(SED) '/^\(# \)\?$(strip $(1))\>/d' $(call KCONFIG_DOT_CONFIG,$(3)) && \
 	echo '$(strip $(2))' >> $(call KCONFIG_DOT_CONFIG,$(3))
 endef