[edk2-devel] [PATCH] BaseTools/Tests: Use quotes around PYTHON_COMMAND

Ard Biesheuvel posted 1 patch 1 year, 6 months ago
Failed in applying to current master (apply log)
BaseTools/Tests/GNUmakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] BaseTools/Tests: Use quotes around PYTHON_COMMAND
Posted by Ard Biesheuvel 1 year, 6 months ago
Commit ("2355f0c09c52 BaseTools: Fix check for ${PYTHON_COMMAND} in
Tests/GNUmakefile") fixed a latent issue in the BaseTools/Tests
Makefile, but inadvertently broke the BaseTools build for cases where
PYTHON_COMMAND is not set. As it turns out, running 'command' without a
command argument makes the invocation succeed, causing the empty
variable to be evaluated and called later.

Let's put double quotes around PYTHON_COMMAND in the invocation of
'command' and force it to fail when PYTHON_COMMAND is not set.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 BaseTools/Tests/GNUmakefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Tests/GNUmakefile b/BaseTools/Tests/GNUmakefile
index caa4d26c9ba6..20b387864f74 100644
--- a/BaseTools/Tests/GNUmakefile
+++ b/BaseTools/Tests/GNUmakefile
@@ -8,7 +8,7 @@
 all: test
 
 test:
-	@if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi
+	@if command -v "${PYTHON_COMMAND}" >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi
 
 clean:
 	find . -name '*.pyc' -exec rm '{}' ';'
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95492): https://edk2.groups.io/g/devel/message/95492
Mute This Topic: https://groups.io/mt/94528814/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] BaseTools/Tests: Use quotes around PYTHON_COMMAND
Posted by Bob Feng 1 year, 6 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ard Biesheuvel
Sent: Monday, October 24, 2022 2:17 PM
To: devel@edk2.groups.io
Cc: quic_llindhol@quicinc.com; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>; rebecca@bsdio.com; Ard Biesheuvel <ardb@kernel.org>
Subject: [edk2-devel] [PATCH] BaseTools/Tests: Use quotes around PYTHON_COMMAND

Commit ("2355f0c09c52 BaseTools: Fix check for ${PYTHON_COMMAND} in
Tests/GNUmakefile") fixed a latent issue in the BaseTools/Tests Makefile, but inadvertently broke the BaseTools build for cases where PYTHON_COMMAND is not set. As it turns out, running 'command' without a command argument makes the invocation succeed, causing the empty variable to be evaluated and called later.

Let's put double quotes around PYTHON_COMMAND in the invocation of 'command' and force it to fail when PYTHON_COMMAND is not set.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 BaseTools/Tests/GNUmakefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Tests/GNUmakefile b/BaseTools/Tests/GNUmakefile index caa4d26c9ba6..20b387864f74 100644
--- a/BaseTools/Tests/GNUmakefile
+++ b/BaseTools/Tests/GNUmakefile
@@ -8,7 +8,7 @@
 all: test  test:-	@if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi+	@if command -v "${PYTHON_COMMAND}" >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi  clean: 	find . -name '*.pyc' -exec rm '{}' ';'-- 
2.35.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95492): https://edk2.groups.io/g/devel/message/95492
Mute This Topic: https://groups.io/mt/94528814/1768742
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [bob.c.feng@intel.com] -=-=-=-=-=-=




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95502): https://edk2.groups.io/g/devel/message/95502
Mute This Topic: https://groups.io/mt/94528814/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] BaseTools/Tests: Use quotes around PYTHON_COMMAND
Posted by Ard Biesheuvel 1 year, 6 months ago
Liming, Bob: could i get an ack on this please? Our CI is currently
broken due to this issue.


On Mon, 24 Oct 2022 at 08:16, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Commit ("2355f0c09c52 BaseTools: Fix check for ${PYTHON_COMMAND} in
> Tests/GNUmakefile") fixed a latent issue in the BaseTools/Tests
> Makefile, but inadvertently broke the BaseTools build for cases where
> PYTHON_COMMAND is not set. As it turns out, running 'command' without a
> command argument makes the invocation succeed, causing the empty
> variable to be evaluated and called later.
>
> Let's put double quotes around PYTHON_COMMAND in the invocation of
> 'command' and force it to fail when PYTHON_COMMAND is not set.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  BaseTools/Tests/GNUmakefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Tests/GNUmakefile b/BaseTools/Tests/GNUmakefile
> index caa4d26c9ba6..20b387864f74 100644
> --- a/BaseTools/Tests/GNUmakefile
> +++ b/BaseTools/Tests/GNUmakefile
> @@ -8,7 +8,7 @@
>  all: test
>
>  test:
> -       @if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi
> +       @if command -v "${PYTHON_COMMAND}" >/dev/null 2>&1; then ${PYTHON_COMMAND} RunTests.py; else python RunTests.py; fi
>
>  clean:
>         find . -name '*.pyc' -exec rm '{}' ';'
> --
> 2.35.1
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95501): https://edk2.groups.io/g/devel/message/95501
Mute This Topic: https://groups.io/mt/94528814/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-