Page 1 of 1

Bug in command expr

Posted: Sat Sep 03, 2011 1:41 pm
by corto
I often face syntax errors on expr when running configure scripts. I wrote a set of tests on Linux to try to identify the cause. I found one : normally "expr 2 \* 6" should work and give "12" but a syntax error happens.
I can provide the sh script that contains all the cases I grouped in, with the expected values (using Linux as reference).

Re: Bug in command expr

Posted: Sat Sep 10, 2011 2:13 pm
by broadblues
I'm sure I've read about this issue before, did you allready post something? or maybe someone else posted it....

Anyway yes I've reproduced the bug in expr, I'm not sure of the status of coreutils though WRT the SDK ie whether it's a contribution or not. If it's a contribution you'll need to send you're bug report to the maintainer (who I think is Henning Nielsen Lund)

Re: Bug in command expr

Posted: Sun Sep 11, 2011 1:41 pm
by broadblues
Having checked with the powers that be, about coreutils status in the SDK, I've opened a bug for it :-)

Bug 7231

Thanks for the report.

Re: Bug in command expr

Posted: Sun Sep 11, 2011 1:43 pm
by broadblues
BTW i f you'd like to attach that test script, it may well be of use.

Re: Bug in command expr

Posted: Sun Sep 11, 2011 2:39 pm
by broadblues
A work arround for expr may be achieved by setting

set DISABLE_COMMANDLINE_WILDCARD_EXPANSION 1

however this may break other aspects of a configure script (untested)

Re: Bug in command expr

Posted: Sun Sep 11, 2011 4:25 pm
by broadblues
A further update on how to fix this with the current SDK

It's an undocumented feature of abc-shell that setting DISABLE_COMMANDLINE_WILDCARD_EXPANSION will disable command wildcard expansion of clib2 based coomands such as those included in coreutils. Abc-shell handles this expansion itself so further expansion is not necessary and creates the bug you see.

So for correct operation either set an amigaos golbal variable with setenv

ie

setenv DISABLE_COMMANDLINE_WILDCARD_EXPANSION 1

or add

export DISABLE_COMMANDLINE_WILDCARD_EXPANSION=1 to your
.abcrc

file in HOME:
or
to the file

SDK:Data/abc-shell/variables

Re: Bug in command expr

Posted: Mon Sep 19, 2011 10:13 pm
by corto
broadblues : First, thank you for the support, for having opened the bug and the proposals.

The script I used to test various cases using expr is here.

I could try to write to modify it using Ruby and its test builtin features.