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

> On Fri, 2005-09-23 at 10:57 +0200, Ralf S. Engelschall wrote:
> > On Fri, Sep 23, 2005, Stuart Shelton wrote:
> > > If I run 'A=$(( 3 + 4 )); echo $A' on different shells, I get the
> > > following results:
> >
> > 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.
>
> If all (three) of the instances of "$((.*))" are replaced in etc/rc,
> then the script does now work, e.g.:
>
> Line 135: "i=$(( $i + 1 )) " -> "(( i++ ))"
> Line 448: "verbose_pos=$(( $verbose_pos + ${#output} ))" ->
> "(( verbose_pos += ${#output} ))"
> Line 455: As above

The correct replacement for "i=$(( $i + 1))" is "i=`expr $i + 1`",
not "(( i++ ))".

> ... then this fixes things for me.
>
> It still looks as if bash is broken on IRIX, but this seems to be
> slightly neater code that works.  Perhaps it's worth changing the rc
> script for the next release, since it shouldn't break on other platforms
> but it does allow IRIX to function correctly?

Errr... no. We are using Bash and hence we are allowed to use its
features. Just because Bash is totally broken on a single platform
(which still not even is a supported one of OpenPKG) shouldn't mean we
already start using those ugly work-arounds. Because if this is already
broken on IRIX, I don't want to imagine myself what other things are
also broken on IRIX :-(

I've no access to an IRIX 6.5 box myself, so my recommendation is either
to give the debugger session a quick try yourself or at least file a bug
report to the Bash maintainers. Perhaps they have already fix in their
development queue...
                                       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