* [PATCH] BaseTools/edksetup.sh: Handle the return value from grep @ 2018-10-02 3:35 Gary Lin [not found] ` <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com> 0 siblings, 1 reply; 2+ messages in thread From: Gary Lin @ 2018-10-02 3:35 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu 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 <glin@suse.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> --- 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 ^ permalink raw reply related [flat|nested] 2+ messages in thread
[parent not found: <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com>]
* Re: [PATCH] BaseTools/edksetup.sh: Handle the return value from grep [not found] ` <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com> @ 2018-10-09 3:43 ` Zhu, Yonghong 0 siblings, 0 replies; 2+ messages in thread From: Zhu, Yonghong @ 2018-10-09 3:43 UTC (permalink / raw) To: edk2-devel@lists.01.org, glin@suse.com; +Cc: Gao, Liming, Zhu, Yonghong Looks good to me. I will push this to Python3 branch. Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gary Lin Sent: Tuesday, October 2, 2018 11:36 AM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com> 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 <glin@suse.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> --- 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 edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-09 3:44 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-10-02 3:35 [PATCH] BaseTools/edksetup.sh: Handle the return value from grep Gary Lin [not found] ` <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com> 2018-10-09 3:43 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox