Bug in command expr

Have a question about our Software Developer Kit? Ask them here.
Post Reply
corto
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 40
Joined: Sun Jun 19, 2011 8:53 am

Bug in command expr

Post 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).
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Bug in command expr

Post 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)
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Bug in command expr

Post 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.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Bug in command expr

Post by broadblues »

BTW i f you'd like to attach that test script, it may well be of use.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Bug in command expr

Post 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)
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Bug in command expr

Post 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
corto
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 40
Joined: Sun Jun 19, 2011 8:53 am

Re: Bug in command expr

Post 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.
Post Reply