Looks good to me. I will push this to Python3 branch.
Reviewed-by: Yonghong Zhu <[email protected]> 

-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Gary Lin
Sent: Tuesday, October 2, 2018 11:36 AM
To: [email protected]
Cc: Gao, Liming <[email protected]>
Subject: [edk2] [PATCH] BaseTools/edksetup.sh: Handle the return value from grep

When SetupPython3() parses the possible python binary paths, it uses `grep 
"[[:digit:]]$"` to filter the python versions in the file name.
Since grep would return 1 when the last character of the file name is not a 
digit, OvmfPkg/build.sh would fail immediately when the function is handling 
some cases, e.g. "python3:".

This commit adds `|| true` to the grep command to make sure the command never 
returns 1 in any condition.

[NOTE: For the python3 branch]

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Yonghong Zhu <[email protected]>
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index 5ff3be19fb2f..d4e577e60781 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -115,7 +115,7 @@ function SetupPython3()  {
   for python in $(whereis python3)
   do
-    python=$(echo $python | grep "[[:digit:]]$")
+    python=$(echo $python | grep "[[:digit:]]$" || true)
     python_version=${python##*python}
     if [ -z "${python_version}" ];then
       continue
--
2.18.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to