Skip to contentSkip to conversation

Makefile: fix config cc version check

PATCH In review Michael S. Tsirkin 3 participants 4 messages Mar 7, 2022 – Apr 4, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: fix config cc version check

.config is of the form:
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)"

while CC_VERSION_TEXT is of the form: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-7)

thus when comparing these, CONFIG_CC_VERSION_TEXT should not be put in "", otherwise we get () outside "" which shell then tries to evaluate.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index daeb5c88b50b..d5c03c827825 100644
@@ -1714,9 +1714,9 @@ PHONY += prepare
 # now expand this into a simple variable to reduce the cost of shell evaluations
 prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
 prepare:
-	@if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \
+	@if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \
 		echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
-		echo >&2 "  The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \
+		echo >&2 "  The kernel was built by: "$(CONFIG_CC_VERSION_TEXT)";" \
 		echo >&2 "  You are using:           $(CC_VERSION_TEXT)"; \
 	fi
 
Signature · 1 line
MST
#1 lore raw
Quoted 3 lines · Michael S. Tsirkin

.config is of the form:
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)"

No. This was changed.

See this:

$ git show 129ab0d2d9f -- Makefile
Quoted 30 lines

while CC_VERSION_TEXT is of the form: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-7)

thus when comparing these, CONFIG_CC_VERSION_TEXT should not be put in "", otherwise we get () outside "" which shell then tries to evaluate.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -3
index daeb5c88b50b..d5c03c827825 100644
@@ -1714,9 +1714,9 @@ PHONY += prepare
 # now expand this into a simple variable to reduce the cost of shell evaluations
 prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
 prepare:
-       @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \
+       @if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \
                echo >&2 "warning: the compiler differs from the one used to build the kernel"; \
-               echo >&2 "  The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \
+               echo >&2 "  The kernel was built by: "$(CONFIG_CC_VERSION_TEXT)";" \
                echo >&2 "  You are using:           $(CC_VERSION_TEXT)"; \
        fi
 
--

MST

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw
Quoted 45 lines · Masahiro Yamada
Quoted 3 lines · Michael S. Tsirkin

.config is of the form:
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)"

No. This was changed.

See this:

$ git show 129ab0d2d9f -- Makefile
Quoted 30 lines

while CC_VERSION_TEXT is of the form: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-7)

thus when comparing these, CONFIG_CC_VERSION_TEXT should not be put in "", otherwise we get () outside "" which shell then tries to evaluate.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile index daeb5c88b50b..d5c03c827825 renamed from Makefile +0 -0

100644 --- a/Makefile +++ b/Makefile @@ -1714,9 +1714,9 @@ PHONY += prepare

 # now expand this into a simple variable to reduce the cost of shell
 evaluations prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
 prepare:
-       @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ];
then \
+       @if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then
\
                echo >&2 "warning: the compiler differs from the one
                used to build the kernel"; \
-               echo >&2 "  The kernel was built by:
$(CONFIG_CC_VERSION_TEXT)"; \ +               echo >&2 "  The kernel
was built by: "$(CONFIG_CC_VERSION_TEXT)";" \
                echo >&2 "  You are using:          
                $(CC_VERSION_TEXT)"; \
        fi
Quoted 2 lines
Quoted 2 lines

--
MST

I believe the patch proposed by Michael indeed fixes an issue introduced by 129ab0d2d9f (Makefile).

Please see the following bug reports:

https://elrepo.org/bugs/view.php?id=1215
https://elrepo.org/bugs/view.php?id=1214

and this forum post:

https://www.phoronix.com/forums/forum/software/general-linux-open-source/
1303986-linux-5-17-rc1-released-a-little-bit-early-but-with-shiny-new- features#post1304036

Akemi

#3 lore raw
Quoted 59 lines · Akemi Yagi
Quoted 45 lines · Masahiro Yamada
Quoted 3 lines · Michael S. Tsirkin

.config is of the form:
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)"

No. This was changed.

See this:

$ git show 129ab0d2d9f -- Makefile
Quoted 30 lines

while CC_VERSION_TEXT is of the form: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-7)

thus when comparing these, CONFIG_CC_VERSION_TEXT should not be put in "", otherwise we get () outside "" which shell then tries to evaluate.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile index daeb5c88b50b..d5c03c827825 renamed from Makefile +0 -0

100644 --- a/Makefile +++ b/Makefile @@ -1714,9 +1714,9 @@ PHONY += prepare

 # now expand this into a simple variable to reduce the cost of shell
 evaluations prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT)
 prepare:
-       @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ];
then \
+       @if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then
\
                echo >&2 "warning: the compiler differs from the one
                used to build the kernel"; \
-               echo >&2 "  The kernel was built by:
$(CONFIG_CC_VERSION_TEXT)"; \ +               echo >&2 "  The kernel
was built by: "$(CONFIG_CC_VERSION_TEXT)";" \
                echo >&2 "  You are using:
                $(CC_VERSION_TEXT)"; \
        fi
Quoted 2 lines
Quoted 2 lines

--
MST

I believe the patch proposed by Michael indeed fixes an issue introduced by 129ab0d2d9f (Makefile).

Please see the following bug reports:

https://elrepo.org/bugs/view.php?id=1215
https://elrepo.org/bugs/view.php?id=1214

Quoted 8 lines

and this forum post:

https://www.phoronix.com/forums/forum/software/general-linux-open-source/
1303986-linux-5-17-rc1-released-a-little-bit-early-but-with-shiny-new- features#post1304036

Akemi

I left a comment:
https://elrepo.org/bugs/view.php?id=1215

This is a bug in ELRepo.

The upstream kernel is good.

Please do not come back to this over again.

Signature · 2 lines
Best Regards
Masahiro Yamada