On Fri, Sep 23, 2005, Stuart Shelton wrote:

> If I run 'A=$(( 3 + 4 )); echo $A' on different shells, I get the
> following results:
>
> $ locate bin/bash
> /usr/bsd/bin/bash
> /usr/gnu/bin/bash
> /usr/nekoware/bin/bash
> /usr/openpkg/bin/bash
>
> $ /usr/bsd/bin/bash --version
> GNU bash, version 3.00.16(1)-release (mips-sgi-irix6.5)
> Copyright (C) 2004 Free Software Foundation, Inc.
> $ /usr/gnu/bin/bash --version
> GNU bash, version 2.05b.0(1)-release (mips-sgi-irix6.5)
> Copyright (C) 2002 Free Software Foundation, Inc.
> $ /usr/nekoware/bin/bash --version
> GNU bash, version 3.00.0(1)-release (mips-sgi-irix6.5)
> Copyright (C) 2004 Free Software Foundation, Inc.
> $ /usr/openpkg/bin/bash --version
> GNU bash, version 3.00.16(1)-release (mips-sgi-irix6.5) [OpenPKG-CURRENT]
> Copyright (C) 2004 Free Software Foundation, Inc.
>
> $ /usr/bsd/bin/bash -c 'A=$(( 3 + 4 )); echo $A'
> /usr/bsd/bin/bash: 3: command not found
> )
> $ /usr/gnu/bin/bash -c 'A=$(( 3 + 4 )); echo $A'
> 7
> $ /usr/nekoware/bin/bash -c 'A=$(( 3 + 4 )); echo $A'
> /usr/nekoware/bin/bash: 3: command not found
> )
> $ /usr/openpkg/bin/bash -c 'A=$(( 3 + 4 )); echo $A'
> /usr/openpkg/bin/bash: 3: command not found
> )
>
> Having said that, the command "A=$(( echo 3 )); echo $A" results in "3)"
> in bash-3 - which surely can't be right?!
>
> The problem is that the rc script in /usr/openpkg/etc/rc uses exactly this
> syntax, and so the errors are similar to:
>
> $ /usr/openpkg/etc/rc all start
> OpenPKG: start: /usr/openpkg/etc/rc: line 448: 0: command not found
> openpkg/usr/openpkg/etc/rc: line 455: ): command not found
> /usr/openpkg/etc/rc: line 665: [: ): integer expression expected
>
> (there are a few more be default which I fixed, but didn't keep a backup
> of the unchanged file)
>
> I tried the same tests on my Linux machine, and all worked.
>
> So is bash-3 broken on my platform (IRIX64)?  I've seen no other problems
> or incompatibilities - but this does seem fairly serious.

As (1) both OpenPKG and non-OpenPKG Bash, (2) both old and new versions
of Bash and (3) the error does not exists on other platforms, I would
say: yes, Bash is broken on your IRIX64 platform.

For me it looks that it already incorrectly _parses_ (and not just
evaluates) the $((..)) construct. The problem you can just hunt down
by using a debugger or at least instrumenting Bash with many debugging
printf's.

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   openpkg-dev@openpkg.org

Reply via email to