Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] sysvinit: start .sh scripts correctly
@ 2013-02-26  1:39 Qi.Chen
  2013-02-26  1:39 ` [PATCH 1/1] " Qi.Chen
  0 siblings, 1 reply; 6+ messages in thread
From: Qi.Chen @ 2013-02-26  1:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Zhenfeng.Zhao

From: Chen Qi <Qi.Chen@windriver.com>

The following changes since commit e96d541c8edccbb69602eace900ce9293ee12d22:

  tiny-init: Mount devtmpfs manually (2013-02-22 06:39:07 -0800)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/sysv-consistent
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/sysv-consistent

Chen Qi (1):
  sysvinit: start .sh scripts correctly

 meta/recipes-core/sysvinit/sysvinit/rc |   16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

-- 
1.7.9.5




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

* [PATCH 1/1] sysvinit: start .sh scripts correctly
  2013-02-26  1:39 [PATCH 0/1] sysvinit: start .sh scripts correctly Qi.Chen
@ 2013-02-26  1:39 ` Qi.Chen
  2013-02-26  2:00   ` Saul Wold
  2013-02-26 11:04   ` Burton, Ross
  0 siblings, 2 replies; 6+ messages in thread
From: Qi.Chen @ 2013-02-26  1:39 UTC (permalink / raw)
  To: openembedded-core; +Cc: Zhenfeng.Zhao

From: Chen Qi <Qi.Chen@windriver.com>

Previously, scripts which end with '.sh' were sourced, so the arguments
like 'start' and 'stop' were just ignored.

This resulted in some init scripts not being able to start correctly.
For example, sourcing hwclock.sh in busybox actually does nothing.
It should be invoked as 'hwclock.sh start' or 'hwclock.sh stop'.

This patch fixes this issue.

[YOCTO #3612]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/sysvinit/sysvinit/rc |   16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index 44bc9bf..50951da 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -41,21 +41,7 @@ startup_progress() {
 startup() {
   # Handle verbosity
   [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
-
-  case "$1" in
-	*.sh)
-		# Source shell script for speed.
-		(
-			trap - INT QUIT TSTP
-			scriptname=$1
-			shift
-			. $scriptname
-		)
-		;;
-	*)
-		"$@"
-		;;
-  esac
+  "$@"
   startup_progress
 }
 
-- 
1.7.9.5




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

* Re: [PATCH 1/1] sysvinit: start .sh scripts correctly
  2013-02-26  1:39 ` [PATCH 1/1] " Qi.Chen
@ 2013-02-26  2:00   ` Saul Wold
  2013-02-26  2:45     ` ChenQi
  2013-02-26 11:04   ` Burton, Ross
  1 sibling, 1 reply; 6+ messages in thread
From: Saul Wold @ 2013-02-26  2:00 UTC (permalink / raw)
  To: Qi.Chen; +Cc: Zhenfeng.Zhao, openembedded-core

On 02/25/2013 05:39 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Previously, scripts which end with '.sh' were sourced, so the arguments
> like 'start' and 'stop' were just ignored.
>
> This resulted in some init scripts not being able to start correctly.
> For example, sourcing hwclock.sh in busybox actually does nothing.
> It should be invoked as 'hwclock.sh start' or 'hwclock.sh stop'.
>
> This patch fixes this issue.
>
> [YOCTO #3612]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>   meta/recipes-core/sysvinit/sysvinit/rc |   16 +---------------
>   1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
> index 44bc9bf..50951da 100755
> --- a/meta/recipes-core/sysvinit/sysvinit/rc
> +++ b/meta/recipes-core/sysvinit/sysvinit/rc
> @@ -41,21 +41,7 @@ startup_progress() {
>   startup() {
>     # Handle verbosity
>     [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
> -
> -  case "$1" in
> -	*.sh)
> -		# Source shell script for speed.
> -		(
> -			trap - INT QUIT TSTP

Are you sure you don't want the trap still?  I realize this reset it to 
default..

Sau!

> -			scriptname=$1
> -			shift
> -			. $scriptname
> -		)
> -		;;
> -	*)
> -		"$@"
> -		;;
> -  esac
> +  "$@"
>     startup_progress
>   }
>
>



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

* Re: [PATCH 1/1] sysvinit: start .sh scripts correctly
  2013-02-26  2:00   ` Saul Wold
@ 2013-02-26  2:45     ` ChenQi
  0 siblings, 0 replies; 6+ messages in thread
From: ChenQi @ 2013-02-26  2:45 UTC (permalink / raw)
  To: Saul Wold; +Cc: Zhenfeng.Zhao, openembedded-core

On 02/26/2013 10:00 AM, Saul Wold wrote:
> On 02/25/2013 05:39 PM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Previously, scripts which end with '.sh' were sourced, so the arguments
>> like 'start' and 'stop' were just ignored.
>>
>> This resulted in some init scripts not being able to start correctly.
>> For example, sourcing hwclock.sh in busybox actually does nothing.
>> It should be invoked as 'hwclock.sh start' or 'hwclock.sh stop'.
>>
>> This patch fixes this issue.
>>
>> [YOCTO #3612]
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> ---
>>   meta/recipes-core/sysvinit/sysvinit/rc |   16 +---------------
>>   1 file changed, 1 insertion(+), 15 deletions(-)
>>
>> diff --git a/meta/recipes-core/sysvinit/sysvinit/rc 
>> b/meta/recipes-core/sysvinit/sysvinit/rc
>> index 44bc9bf..50951da 100755
>> --- a/meta/recipes-core/sysvinit/sysvinit/rc
>> +++ b/meta/recipes-core/sysvinit/sysvinit/rc
>> @@ -41,21 +41,7 @@ startup_progress() {
>>   startup() {
>>     # Handle verbosity
>>     [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
>> -
>> -  case "$1" in
>> -    *.sh)
>> -        # Source shell script for speed.
>> -        (
>> -            trap - INT QUIT TSTP
>
> Are you sure you don't want the trap still?  I realize this reset it 
> to default..
>
Yes.

Code snippet from rc:
   # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
   trap ":" INT QUIT TSTP

So these signals are ignored in rc but passed on to subprocesses.
And the reset is not needed.

If in rc we use
     trap "" INIT QUIT TSTP
then the reset is needed.

Best Regards,
Chen Qi

> Sau!
>
>> -            scriptname=$1
>> -            shift
>> -            . $scriptname
>> -        )
>> -        ;;
>> -    *)
>> -        "$@"
>> -        ;;
>> -  esac
>> +  "$@"
>>     startup_progress
>>   }
>>
>>
>
>




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

* Re: [PATCH 1/1] sysvinit: start .sh scripts correctly
  2013-02-26  1:39 ` [PATCH 1/1] " Qi.Chen
  2013-02-26  2:00   ` Saul Wold
@ 2013-02-26 11:04   ` Burton, Ross
  2013-02-27  3:26     ` ChenQi
  1 sibling, 1 reply; 6+ messages in thread
From: Burton, Ross @ 2013-02-26 11:04 UTC (permalink / raw)
  To: Qi.Chen; +Cc: Zhenfeng.Zhao, openembedded-core

On 26 February 2013 01:39,  <Qi.Chen@windriver.com> wrote:
> -
> -  case "$1" in
> -       *.sh)
> -               # Source shell script for speed.
> -               (
> -                       trap - INT QUIT TSTP
> -                       scriptname=$1
> -                       shift
> -                       . $scriptname
> -               )
> -               ;;
> -       *)
> -               "$@"
> -               ;;
> -  esac
> +  "$@"
>    startup_progress
>  }

NACK.

By "fix" you mean "remove the tested and proven optimisation"? The "if
.sh use ." test was designed to speed up booting by not forking a new
bash, and it's been demonstrated to have a noticeable difference on
slower hardware.

You can pass arguments to "." as this little test demonstrates:

$ cat service.sh
echo My arguments are "$@"
$ . service.sh foo bar
My arguments are foo bar

The "shift" command shows that passing the arguments to the script was
the intention, and a few lines of micro-test demonstrate that it
*should* work:

$ cat rc.sh
startup() {
    scriptname=$1
    shift
    . $scriptname
}
startup ./service.sh start
$ busybox sh ./rc.sh
My arguments are start

So, something else is going wrong.

Ross



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

* Re: [PATCH 1/1] sysvinit: start .sh scripts correctly
  2013-02-26 11:04   ` Burton, Ross
@ 2013-02-27  3:26     ` ChenQi
  0 siblings, 0 replies; 6+ messages in thread
From: ChenQi @ 2013-02-27  3:26 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Zhenfeng.Zhao, openembedded-core

On 02/26/2013 07:04 PM, Burton, Ross wrote:
> On 26 February 2013 01:39,  <Qi.Chen@windriver.com> wrote:
>> -
>> -  case "$1" in
>> -       *.sh)
>> -               # Source shell script for speed.
>> -               (
>> -                       trap - INT QUIT TSTP
>> -                       scriptname=$1
>> -                       shift
>> -                       . $scriptname
>> -               )
>> -               ;;
>> -       *)
>> -               "$@"
>> -               ;;
>> -  esac
>> +  "$@"
>>     startup_progress
>>   }
> NACK.
>
> By "fix" you mean "remove the tested and proven optimisation"? The "if
> .sh use ." test was designed to speed up booting by not forking a new
> bash, and it's been demonstrated to have a noticeable difference on
> slower hardware.
>
> You can pass arguments to "." as this little test demonstrates:
>
> $ cat service.sh
> echo My arguments are "$@"
> $ . service.sh foo bar
> My arguments are foo bar
>
> The "shift" command shows that passing the arguments to the script was
> the intention, and a few lines of micro-test demonstrate that it
> *should* work:
>
> $ cat rc.sh
> startup() {
>      scriptname=$1
>      shift
>      . $scriptname
> }
> startup ./service.sh start
> $ busybox sh ./rc.sh
> My arguments are start
>
> So, something else is going wrong.
>
> Ross
>
>
Yes, you're right.
I absolutely made a mistake.

Thank you for pointing it out.

Best Regards,
Chen Qi



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

end of thread, other threads:[~2013-02-27  3:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26  1:39 [PATCH 0/1] sysvinit: start .sh scripts correctly Qi.Chen
2013-02-26  1:39 ` [PATCH 1/1] " Qi.Chen
2013-02-26  2:00   ` Saul Wold
2013-02-26  2:45     ` ChenQi
2013-02-26 11:04   ` Burton, Ross
2013-02-27  3:26     ` ChenQi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox