All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof.johansson@axis.com>
To: Diego Sueiro <diego.sueiro@gmail.com>
Cc: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: busybox 1.21 ash bug?
Date: Tue, 10 Dec 2013 16:53:26 +0100	[thread overview]
Message-ID: <20131210155326.GV31548@axis.com> (raw)
In-Reply-To: <CAMCfZKHWGAQJ95K=T-0xpQRoO+RKvgvx9AWKMP9SUPMjAnTUDQ@mail.gmail.com>

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


  reply	other threads:[~2013-12-10 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 12:22 busybox 1.21 ash bug? Diego Sueiro
2013-12-10 15:53 ` Olof Johansson [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131210155326.GV31548@axis.com \
    --to=olof.johansson@axis.com \
    --cc=diego.sueiro@gmail.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.