[OE-core] [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script

Andre McCurdy armccurdy at gmail.com
Wed Sep 5 03:36:47 UTC 2018


On Tue, Sep 4, 2018 at 8:18 PM, Hongxu Jia <hongxu.jia at windriver.com> wrote:
> On 2018年09月05日 10:41, Andre McCurdy wrote:
>>
>> On Tue, Sep 4, 2018 at 7:16 PM, Hongxu Jia <hongxu.jia at windriver.com>
>> wrote:
>>>
>>> On 2018年09月05日 09:59, Andre McCurdy wrote:
>>>>
>>>> On Tue, Sep 4, 2018 at 6:02 PM, Hongxu Jia <hongxu.jia at windriver.com>
>>>> wrote:
>>>>>
>>>>> On 2018年09月05日 03:14, Andre McCurdy wrote:
>>>>>>
>>>>>> Maybe I'm missing something, but what's the advantage of using SHELL
>>>>>> to run this little wrapper script rather than hardcoding /bin/sh ?
>>>>>>
>>>>>> Task shell scripts created by bitbake use hardcoded /bin/sh (see
>>>>>> bitbake/lib/bb/build.py -> shell_trap_code())
>>>>>
>>>>> Keep align with the devshell as the comments mentioned above
>>>>
>>>> Yeah, I've read the comments. I still don't really understand why.
>>>>
>>>>> The devshell.bbclass set var-SHELL to var-DEVSHELL, and
>>>>> terminal.bbclass
>>>>> initial var-SHELL with `bash'. Keep sync with it, use var-SHELL rather
>>>>> than hardcoded `/bin/sh' as the shebang of wrapper script.
>>>>>
>>>>> On Ubuntu host, default shell is dash (/bin/sh -> dash), even though
>>>>> we assign var-SHELL with `/bin/bash', the wrapper script is still
>>>>> dashism.
>>>>
>>>> What exactly is a dashism?
>>>
>>>
>>> In another word, it does not support bashism.
>>>
>>> Here is a case which `export -f' is bashism although
>>>
>>> devshell using bash, but /bin/sh -> dash
>>>
>>> [case]
>>>
>>> function foobar { echo foobar; };
>>>   export -f foobar
>>> bitbake -c devshell virtual/kernel
>>>
>>> [case]
>>>
>>>
>>> BTW, I've sent anther patch to fix it `[OE-core] [PATCH]
>>> devshell.bbclass/terminal.bbclass: add a shell check at devshell'
>>
>> OK, but run.do_terminal.xxx is a trivial wrapper which (apart from
>> exporting environment variables) just contains something like:
>>
>>    do_terminal() {
>>    exec pseudo /bin/bash
>>    }
>>
>>    do_terminal
>>
>> I'm not sure what the problem is running that with /bin/sh, regardless
>> of whether /bin/sh points to bash or dash?
>
>
> Isn't clear? In above case, even though `exec pseudo /bin/bash',
>
> since /bin/sh points to dash, the devshell started failed
>
> [snip]
>
> bitbake -c devshell virtual/kernel
> Trying to run: screen -r devshell_23640
> Cannot open your terminal '/dev/pts/39' - please check.
>
> [snip]
>
> Since `export -f' is bashism, use dash to load wrapper script failed

I understand that dash can not run bash specific syntax. What I don't
understand is where does the bash specific syntax in the terminal
wrapper script come from?



More information about the Openembedded-core mailing list