All of lore.kernel.org
 help / color / mirror / Atom feed
* busybox 1.21 ash bug?
@ 2013-12-10 12:22 Diego Sueiro
  2013-12-10 15:53 ` Olof Johansson
       [not found] ` <20131210154634.GU31548@axis.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Diego Sueiro @ 2013-12-10 12:22 UTC (permalink / raw)
  To: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]

Folks,

Recently I switched to dora branch which builds busybox 1.21.
I was using dylan branch with busybox 1.20 and the some shell scripts
stopped working.
There is a problem related with "for" statements.

For example, on script below, it runs nice on busybox 1.20 but on 1.21
fails with the output:"./script.sh: line 3: syntax error: bad for loop
variable".

#!/bin/sh

for (( i=1; i <= 5; i++ ))
do
 echo "Random number $i: $RANDOM"
done


I've searched on busybox bug tracking but did not found nothing related
with this.

Maybe I'm missing something, I really don't know.

I appreciate any help with this, and I'm sorry if this is not the
appropriate list to discuss this kind of subject.



Regards,

--
*dS
Diego Sueiro

/*long live rock 'n roll*/

[-- Attachment #2: Type: text/html, Size: 1661 bytes --]

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

* Re: busybox 1.21 ash bug?
  2013-12-10 12:22 busybox 1.21 ash bug? Diego Sueiro
@ 2013-12-10 15:53 ` Olof Johansson
       [not found] ` <20131210154634.GU31548@axis.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Olof Johansson @ 2013-12-10 15:53 UTC (permalink / raw)
  To: Diego Sueiro; +Cc: yocto@yoctoproject.org

Hi,

[Sorry for duplicate replies, apparently I wasn't subscribed
 with the right email address.]

On 13-12-10 13:22 +0100, Diego Sueiro wrote:
> Recently I switched to dora branch which builds busybox 1.21.
> I was using dylan branch with busybox 1.20 and the some shell
> scripts stopped working.  There is a problem related with "for"
> statements.
> 
> For example, on script below, it runs nice on busybox 1.20 but
> on 1.21 fails with the output: "./script.sh: line 3: syntax
> error: bad for loop variable".
> 
> #!/bin/sh
> 
> for (( i=1; i <= 5; i++ ))
> do
>  echo "Random number $i: $RANDOM"
> done

That type of for loop is a bashism; as far as I know and can
tell, busybox ash does not support it (even with ASH_BASH_COMPAT=y).

The code that is executed when the parser finds a "for" token:

ash.c: parse_command(void)
    ...
    switch (readtoken()) {
    ...
    case TFOR:
        if (readtoken() != TWORD || quoteflag || !goodname(wordtext))
            raise_error_syntax("bad for loop variable");

Are you sure it's using busybox ash when it actually works? I can
reproduce the error message your are seeing in both busybox 1.20
and 1.21.


RANDOM is also an extension, but one that is supported by busybox
(or rather, can be). The default defconfig in oe-core does not
enable it, see ASH_RANDOM_SUPPORT.

-- 
olofjn


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

* Re: busybox 1.21 ash bug?
       [not found] ` <20131210154634.GU31548@axis.com>
@ 2013-12-10 17:14   ` Diego Sueiro
  2013-12-10 17:25     ` Paul Eggleton
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Sueiro @ 2013-12-10 17:14 UTC (permalink / raw)
  To: Olof Johansson; +Cc: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On Tue, Dec 10, 2013 at 1:46 PM, Olof Johansson <olof.johansson@axis.com>wrote:

> That type of for loop is a bashism; as far as I know and can
> tell, busybox ash does not support it (even with ASH_BASH_COMPAT=y).
>
> The code that is executed when the parser finds a "for" token:
>
> ash.c: parse_command(void)
>     ...
>     switch (readtoken()) {
>     ...
>     case TFOR:
>         if (readtoken() != TWORD || quoteflag || !goodname(wordtext))
>             raise_error_syntax("bad for loop variable");
>
> Are you sure it's using busybox ash when it actually works? I can
> reproduce the error message your are seeing in both busybox 1.20
> and 1.21.
>

>
> RANDOM is also an extension, but one that is supported by busybox
> (or rather, can be). The default defconfig in oe-core does not
> enable it, see ASH_RANDOM_SUPPORT.
>
I have a bbappend to enable it.

What a shame. I'm really sorry about the buzz.

I'm working based on Angstrom distribution setup-scripts, and for dylan
version it is using bash as the default shell and for dora version it is
using the ash from busybox.


Regards,

--
*dS
Diego Sueiro

/*long live rock 'n roll*/

[-- Attachment #2: Type: text/html, Size: 2158 bytes --]

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

* Re: busybox 1.21 ash bug?
  2013-12-10 17:14   ` Diego Sueiro
@ 2013-12-10 17:25     ` Paul Eggleton
  2013-12-10 17:46       ` Diego Sueiro
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggleton @ 2013-12-10 17:25 UTC (permalink / raw)
  To: Diego Sueiro; +Cc: yocto

On Tuesday 10 December 2013 15:14:21 Diego Sueiro wrote:
> On Tue, Dec 10, 2013 at 1:46 PM, Olof Johansson 
<olof.johansson@axis.com>wrote:
> > That type of for loop is a bashism; as far as I know and can
> > tell, busybox ash does not support it (even with ASH_BASH_COMPAT=y).
> > 
> > The code that is executed when the parser finds a "for" token:
> > 
> > ash.c: parse_command(void)
> > 
> >     ...
> >     switch (readtoken()) {
> >     ...
> >     
> >     case TFOR:
> >         if (readtoken() != TWORD || quoteflag || !goodname(wordtext))
> >         
> >             raise_error_syntax("bad for loop variable");
> > 
> > Are you sure it's using busybox ash when it actually works? I can
> > reproduce the error message your are seeing in both busybox 1.20
> > and 1.21.
> > 
> > 
> > 
> > RANDOM is also an extension, but one that is supported by busybox
> > (or rather, can be). The default defconfig in oe-core does not
> > enable it, see ASH_RANDOM_SUPPORT.
> 
> I have a bbappend to enable it.
> 
> What a shame. I'm really sorry about the buzz.
> 
> I'm working based on Angstrom distribution setup-scripts, and for dylan
> version it is using bash as the default shell and for dora version it is
> using the ash from busybox.

Assuming that wasn't a deliberate change, it's likely that something that 
depended on bash was bringing it in before and either that something is no 
longer in the image, or it no longer depends on bash. (You can of course 
explicitly add bash to the image if that's what you want.)

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: busybox 1.21 ash bug?
  2013-12-10 17:25     ` Paul Eggleton
@ 2013-12-10 17:46       ` Diego Sueiro
  0 siblings, 0 replies; 5+ messages in thread
From: Diego Sueiro @ 2013-12-10 17:46 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

On Tue, Dec 10, 2013 at 3:25 PM, Paul Eggleton <
paul.eggleton@linux.intel.com> wrote:

> Assuming that wasn't a deliberate change, it's likely that something that
> depended on bash was bringing it in before and either that something is no
> longer in the image, or it no longer depends on bash. (You can of course
> explicitly add bash to the image if that's what you want.)
>

Thanks Paul,

I added bash on my image.

Rgs,

--
*dS
Diego Sueiro

/*long live rock 'n roll*/

[-- Attachment #2: Type: text/html, Size: 1011 bytes --]

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

end of thread, other threads:[~2013-12-10 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 12:22 busybox 1.21 ash bug? Diego Sueiro
2013-12-10 15:53 ` Olof Johansson
     [not found] ` <20131210154634.GU31548@axis.com>
2013-12-10 17:14   ` Diego Sueiro
2013-12-10 17:25     ` Paul Eggleton
2013-12-10 17:46       ` Diego Sueiro

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.