> -----Original Message----- > From: openembedded-core-boun...@lists.openembedded.org <openembedded- > core-boun...@lists.openembedded.org> On Behalf Of Hongxu Jia > Sent: den 26 november 2018 02:57 > To: openembedded-core@lists.openembedded.org; Richard Purdie > <richard.pur...@linuxfoundation.org> > Subject: Re: [OE-core] [PATCH] devshell.bbclass/terminal.bbclass: add a > shell check at devshell > > 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'
I simply fail to understand why all this messing around is needed. Why use ${SHELL} at all? Why not always use /bin/sh? We know it is either /bin/bash or /bin/dash, and either should be fine to use to run the wrapper script. > > > > Signed-off-by: Hongxu Jia <hongxu....@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) > //Peter -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core