From: Hongxu Jia <hongxu.jia@windriver.com>
To: <openembedded-core@lists.openembedded.org>,
Richard Purdie <richard.purdie@linuxfoundation.org>
Subject: Re: [PATCH] devshell.bbclass/terminal.bbclass: add a shell check at devshell
Date: Mon, 26 Nov 2018 09:57:00 +0800 [thread overview]
Message-ID: <3c29358c-8127-fdda-c6ad-26adcc8b1193@windriver.com> (raw)
In-Reply-To: <1535958596-11573-1-git-send-email-hongxu.jia@windriver.com>
Ping, any comments?
//Hongxu
On 2018/9/3 下午3:09, Hongxu Jia wrote:
> While var-SHELL is neither `bash' or `dash', such as
> `csh', loading the wrapper script will fail at devshell,
> because csh does not support syntax `export'.
>
> Add a shell check at devshell, and use `/bin/sh' to replace
> if shell is neither `bash' or `dash'. `/bin/sh' is safe to
> use since `ecdfdd7 sanity.bbclass: check /bin/sh is dash
> or bash'
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
> meta/classes/devshell.bbclass | 4 ++++
> meta/classes/terminal.bbclass | 4 +++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass
> index fdf7dc1..c4765db 100644
> --- a/meta/classes/devshell.bbclass
> +++ b/meta/classes/devshell.bbclass
> @@ -3,6 +3,10 @@ inherit terminal
> DEVSHELL = "${SHELL}"
>
> python do_devshell () {
> + devshell = d.getVar('DEVSHELL')
> + devshell = devshell if devshell.endswith("bash") or devshell.endswith("dash") else '/bin/sh'
> + d.setVar('DEVSHELL', devshell)
> +
> if d.getVarFlag("do_devshell", "manualfakeroot"):
> d.prependVar("DEVSHELL", "pseudo ")
> fakeenv = d.getVar("FAKEROOTENV").split()
> diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
> index 73e765d..f427538 100644
> --- a/meta/classes/terminal.bbclass
> +++ b/meta/classes/terminal.bbclass
> @@ -25,7 +25,9 @@ def emit_terminal_func(command, envdata, d):
> bb.utils.mkdirhier(os.path.dirname(runfile))
>
> with open(runfile, 'w') as script:
> - script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
> + shell = d.getVar('SHELL')
> + shell = shell if shell.endswith("bash") or shell.endswith("dash") else '/bin/sh'
> + script.write('#!/usr/bin/env %s\n' % shell)
> script.write('set -e\n')
> bb.data.emit_func(cmd_func, script, envdata)
> script.write(cmd_func)
next prev parent reply other threads:[~2018-11-26 1:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 7:09 [PATCH] devshell.bbclass/terminal.bbclass: add a shell check at devshell Hongxu Jia
2018-11-26 1:57 ` Hongxu Jia [this message]
2018-11-27 19:37 ` Peter Kjellerstedt
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-all 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=3c29358c-8127-fdda-c6ad-26adcc8b1193@windriver.com \
--to=hongxu.jia@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.