All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
@ 2018-08-24  8:54 Hongxu Jia
  2018-09-01  0:14 ` Alejandro Enedino Hernandez Samaniego
  0 siblings, 1 reply; 11+ messages in thread
From: Hongxu Jia @ 2018-08-24  8:54 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/terminal.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index a27e10c..73e765d 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -25,7 +25,8 @@ def emit_terminal_func(command, envdata, d):
     bb.utils.mkdirhier(os.path.dirname(runfile))
 
     with open(runfile, 'w') as script:
-        script.write('#!/bin/sh -e\n')
+        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
+        script.write('set -e\n')
         bb.data.emit_func(cmd_func, script, envdata)
         script.write(cmd_func)
         script.write("\n")
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-08-24  8:54 [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script Hongxu Jia
@ 2018-09-01  0:14 ` Alejandro Enedino Hernandez Samaniego
  2018-09-03  5:52   ` Hongxu Jia
  0 siblings, 1 reply; 11+ messages in thread
From: Alejandro Enedino Hernandez Samaniego @ 2018-09-01  0:14 UTC (permalink / raw)
  To: openembedded-core

Hey Hongxu,


On 08/24/2018 01:54 AM, Hongxu Jia wrote:
> 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.
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>   meta/classes/terminal.bbclass | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
> index a27e10c..73e765d 100644
> --- a/meta/classes/terminal.bbclass
> +++ b/meta/classes/terminal.bbclass
> @@ -25,7 +25,8 @@ def emit_terminal_func(command, envdata, d):
>       bb.utils.mkdirhier(os.path.dirname(runfile))
>   
>       with open(runfile, 'w') as script:
> -        script.write('#!/bin/sh -e\n')
> +        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
> +        script.write('set -e\n')
This is causing a bug on several systems, I believe that it is because 
the way our systems are set up,
basically, our running shell isn't necessarily $SHELL, so it is causing 
the process to exit immediately,
anything thats using this class is affected, devshell, menuconfig, etc.


$ echo $SHELL
/bin/csh

$ echo $0
/bin/bash



Sadly we are unable to set $SHELL correctly.

I wonder if there is another way of doing this that wouldn't cause this 
behavior.

Cheers,

Alejandro


>           bb.data.emit_func(cmd_func, script, envdata)
>           script.write(cmd_func)
>           script.write("\n")



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-01  0:14 ` Alejandro Enedino Hernandez Samaniego
@ 2018-09-03  5:52   ` Hongxu Jia
  2018-09-04 16:36     ` Alejandro Enedino Hernandez Samaniego
  0 siblings, 1 reply; 11+ messages in thread
From: Hongxu Jia @ 2018-09-03  5:52 UTC (permalink / raw)
  To: Alejandro Enedino Hernandez Samaniego, openembedded-core

On 2018年09月01日 08:14, Alejandro Enedino Hernandez Samaniego wrote:
> Hey Hongxu,
>
>
> On 08/24/2018 01:54 AM, Hongxu Jia wrote:
>> 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.
>>
>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>> ---
>>   meta/classes/terminal.bbclass | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/terminal.bbclass 
>> b/meta/classes/terminal.bbclass
>> index a27e10c..73e765d 100644
>> --- a/meta/classes/terminal.bbclass
>> +++ b/meta/classes/terminal.bbclass
>> @@ -25,7 +25,8 @@ def emit_terminal_func(command, envdata, d):
>>       bb.utils.mkdirhier(os.path.dirname(runfile))
>>         with open(runfile, 'w') as script:
>> -        script.write('#!/bin/sh -e\n')
>> +        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
>> +        script.write('set -e\n')
> This is causing a bug on several systems, I believe that it is because 
> the way our systems are set up,
> basically, our running shell isn't necessarily $SHELL, so it is 
> causing the process to exit immediately,
> anything thats using this class is affected, devshell, menuconfig, etc.
>
>
> $ echo $SHELL
> /bin/csh
>
> $ echo $0
> /bin/bash
>

The csh does not support `export', in you case, you should correct 
var-SHELL to align with $0,

Such as:
$ usermod <username> -s $0



But the script should be more robust, it should
work well in this situation. I will try to fix it.

//Hongxu

>
>
> Sadly we are unable to set $SHELL correctly.
>
> I wonder if there is another way of doing this that wouldn't cause 
> this behavior.
>
> Cheers,
>
> Alejandro
>
>
>>           bb.data.emit_func(cmd_func, script, envdata)
>>           script.write(cmd_func)
>>           script.write("\n")
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-03  5:52   ` Hongxu Jia
@ 2018-09-04 16:36     ` Alejandro Enedino Hernandez Samaniego
  2018-09-04 19:14       ` Andre McCurdy
  0 siblings, 1 reply; 11+ messages in thread
From: Alejandro Enedino Hernandez Samaniego @ 2018-09-04 16:36 UTC (permalink / raw)
  To: Hongxu Jia, Alejandro Enedino Hernandez Samaniego, openembedded-core

Hey Hongxu,


On 09/02/2018 10:52 PM, Hongxu Jia wrote:
> On 2018年09月01日 08:14, Alejandro Enedino Hernandez Samaniego wrote:
>> Hey Hongxu,
>>
>>
>> On 08/24/2018 01:54 AM, Hongxu Jia wrote:
>>> 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.
>>>
>>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>>> ---
>>>   meta/classes/terminal.bbclass | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta/classes/terminal.bbclass 
>>> b/meta/classes/terminal.bbclass
>>> index a27e10c..73e765d 100644
>>> --- a/meta/classes/terminal.bbclass
>>> +++ b/meta/classes/terminal.bbclass
>>> @@ -25,7 +25,8 @@ def emit_terminal_func(command, envdata, d):
>>>       bb.utils.mkdirhier(os.path.dirname(runfile))
>>>         with open(runfile, 'w') as script:
>>> -        script.write('#!/bin/sh -e\n')
>>> +        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
>>> +        script.write('set -e\n')
>> This is causing a bug on several systems, I believe that it is 
>> because the way our systems are set up,
>> basically, our running shell isn't necessarily $SHELL, so it is 
>> causing the process to exit immediately,
>> anything thats using this class is affected, devshell, menuconfig, etc.
>>
>>
>> $ echo $SHELL
>> /bin/csh
>>
>> $ echo $0
>> /bin/bash
>>
>
> The csh does not support `export', in you case, you should correct 
> var-SHELL to align with $0,
>
> Such as:
> $ usermod <username> -s $0

I absolutely agree, but as I was saying, because the way the system is 
set up, it does not allow me to do so.

Thanks!

Alejandro
>
>
>
> But the script should be more robust, it should
> work well in this situation. I will try to fix it.
>
> //Hongxu
>
>>
>>
>> Sadly we are unable to set $SHELL correctly.
>>
>> I wonder if there is another way of doing this that wouldn't cause 
>> this behavior.
>>
>> Cheers,
>>
>> Alejandro
>>
>>
>>>           bb.data.emit_func(cmd_func, script, envdata)
>>>           script.write(cmd_func)
>>>           script.write("\n")
>>
>



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-04 16:36     ` Alejandro Enedino Hernandez Samaniego
@ 2018-09-04 19:14       ` Andre McCurdy
  2018-09-05  1:02         ` Hongxu Jia
  0 siblings, 1 reply; 11+ messages in thread
From: Andre McCurdy @ 2018-09-04 19:14 UTC (permalink / raw)
  To: Alejandro Enedino Hernandez Samaniego; +Cc: OE Core mailing list

On Tue, Sep 4, 2018 at 9:36 AM, Alejandro Enedino Hernandez Samaniego
<alejandro.enedino.hernandez-samaniego@xilinx.com> wrote:
> Hey Hongxu,
>
>
>
> On 09/02/2018 10:52 PM, Hongxu Jia wrote:
>>
>> On 2018年09月01日 08:14, Alejandro Enedino Hernandez Samaniego wrote:
>>>
>>> Hey Hongxu,
>>>
>>>
>>> On 08/24/2018 01:54 AM, Hongxu Jia wrote:
>>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>>>> ---
>>>>   meta/classes/terminal.bbclass | 3 ++-
>>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/meta/classes/terminal.bbclass
>>>> b/meta/classes/terminal.bbclass
>>>> index a27e10c..73e765d 100644
>>>> --- a/meta/classes/terminal.bbclass
>>>> +++ b/meta/classes/terminal.bbclass
>>>> @@ -25,7 +25,8 @@ def emit_terminal_func(command, envdata, d):
>>>>       bb.utils.mkdirhier(os.path.dirname(runfile))
>>>>         with open(runfile, 'w') as script:
>>>> -        script.write('#!/bin/sh -e\n')
>>>> +        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
>>>> +        script.write('set -e\n')
>>>
>>> This is causing a bug on several systems, I believe that it is because
>>> the way our systems are set up,
>>> basically, our running shell isn't necessarily $SHELL, so it is causing
>>> the process to exit immediately,
>>> anything thats using this class is affected, devshell, menuconfig, etc.
>>>
>>>
>>> $ echo $SHELL
>>> /bin/csh
>>>
>>> $ echo $0
>>> /bin/bash
>>>
>>
>> The csh does not support `export', in you case, you should correct
>> var-SHELL to align with $0,
>>
>> Such as:
>> $ usermod <username> -s $0
>
>
> I absolutely agree, but as I was saying, because the way the system is set
> up, it does not allow me to do so.

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())


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-04 19:14       ` Andre McCurdy
@ 2018-09-05  1:02         ` Hongxu Jia
  2018-09-05  1:59           ` Andre McCurdy
  0 siblings, 1 reply; 11+ messages in thread
From: Hongxu Jia @ 2018-09-05  1:02 UTC (permalink / raw)
  To: Andre McCurdy, Alejandro Enedino Hernandez Samaniego; +Cc: OE Core mailing list

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

...

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.

...


//Hongxu



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-05  1:02         ` Hongxu Jia
@ 2018-09-05  1:59           ` Andre McCurdy
  2018-09-05  2:16             ` Hongxu Jia
  0 siblings, 1 reply; 11+ messages in thread
From: Andre McCurdy @ 2018-09-05  1:59 UTC (permalink / raw)
  To: Hongxu Jia; +Cc: Alejandro Enedino Hernandez Samaniego, OE Core mailing list

On Tue, Sep 4, 2018 at 6:02 PM, Hongxu Jia <hongxu.jia@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?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-05  1:59           ` Andre McCurdy
@ 2018-09-05  2:16             ` Hongxu Jia
  2018-09-05  2:41               ` Andre McCurdy
  0 siblings, 1 reply; 11+ messages in thread
From: Hongxu Jia @ 2018-09-05  2:16 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: Alejandro Enedino Hernandez Samaniego, OE Core mailing list

On 2018年09月05日 09:59, Andre McCurdy wrote:
> On Tue, Sep 4, 2018 at 6:02 PM, Hongxu Jia <hongxu.jia@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'

//Hongxu




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-05  2:16             ` Hongxu Jia
@ 2018-09-05  2:41               ` Andre McCurdy
  2018-09-05  3:18                 ` Hongxu Jia
  0 siblings, 1 reply; 11+ messages in thread
From: Andre McCurdy @ 2018-09-05  2:41 UTC (permalink / raw)
  To: Hongxu Jia; +Cc: Alejandro Enedino Hernandez Samaniego, OE Core mailing list

On Tue, Sep 4, 2018 at 7:16 PM, Hongxu Jia <hongxu.jia@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@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?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-05  2:41               ` Andre McCurdy
@ 2018-09-05  3:18                 ` Hongxu Jia
  2018-09-05  3:36                   ` Andre McCurdy
  0 siblings, 1 reply; 11+ messages in thread
From: Hongxu Jia @ 2018-09-05  3:18 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: Alejandro Enedino Hernandez Samaniego, OE Core mailing list

On 2018年09月05日 10:41, Andre McCurdy wrote:
> On Tue, Sep 4, 2018 at 7:16 PM, Hongxu Jia <hongxu.jia@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@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


//Hongxu



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script
  2018-09-05  3:18                 ` Hongxu Jia
@ 2018-09-05  3:36                   ` Andre McCurdy
  0 siblings, 0 replies; 11+ messages in thread
From: Andre McCurdy @ 2018-09-05  3:36 UTC (permalink / raw)
  To: Hongxu Jia; +Cc: Alejandro Enedino Hernandez Samaniego, OE Core mailing list

On Tue, Sep 4, 2018 at 8:18 PM, Hongxu Jia <hongxu.jia@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@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@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?


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-09-05  3:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24  8:54 [PATCH] terminal.bbclass: use var-SHELL as the shebang of wrapper script Hongxu Jia
2018-09-01  0:14 ` Alejandro Enedino Hernandez Samaniego
2018-09-03  5:52   ` Hongxu Jia
2018-09-04 16:36     ` Alejandro Enedino Hernandez Samaniego
2018-09-04 19:14       ` Andre McCurdy
2018-09-05  1:02         ` Hongxu Jia
2018-09-05  1:59           ` Andre McCurdy
2018-09-05  2:16             ` Hongxu Jia
2018-09-05  2:41               ` Andre McCurdy
2018-09-05  3:18                 ` Hongxu Jia
2018-09-05  3:36                   ` Andre McCurdy

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.