public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"glin@suse.com" <glin@suse.com>
Cc: "Gao, Liming" <liming.gao@intel.com>,
	"Zhu, Yonghong" <yonghong.zhu@intel.com>
Subject: Re: [PATCH] BaseTools/edksetup.sh: Handle the return value from grep
Date: Tue, 9 Oct 2018 03:43:49 +0000	[thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D5213C066@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com>

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


      parent reply	other threads:[~2018-10-09  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D5213C066@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox