public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH] BaseTools/edksetup.sh: Handle the return value from grep
Date: Tue,  2 Oct 2018 11:35:41 +0800	[thread overview]
Message-ID: <20181002033541.17076-1-glin@suse.com> (raw)

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



             reply	other threads:[~2018-10-02  3:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  3:35 Gary Lin [this message]
     [not found] ` <47C64442C08CCD4089DC43B6B5E46BC48ECC92@shsmsx102.ccr.corp.intel.com>
2018-10-09  3:43   ` [PATCH] BaseTools/edksetup.sh: Handle the return value from grep Zhu, Yonghong

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=20181002033541.17076-1-glin@suse.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