Bug in command expr

Have a question about our Software Developer Kit? Ask them here.

Bug in command expr

Postby corto » Sat Sep 03, 2011 2:41 pm

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).
corto
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 33
Joined: Sun Jun 19, 2011 9:53 am

Re: Bug in command expr

Postby broadblues » Sat Sep 10, 2011 3:13 pm

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: 521
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Bug in command expr

Postby broadblues » Sun Sep 11, 2011 2:41 pm

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: 521
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Bug in command expr

Postby broadblues » Sun Sep 11, 2011 2:43 pm

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: 521
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Bug in command expr

Postby broadblues » Sun Sep 11, 2011 3:39 pm

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: 521
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Bug in command expr

Postby broadblues » Sun Sep 11, 2011 5:25 pm

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
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 521
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Bug in command expr

Postby corto » Mon Sep 19, 2011 11:13 pm

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.
corto
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 33
Joined: Sun Jun 19, 2011 9:53 am


Return to SDK Support

Who is online

Users browsing this forum: No registered users and 2 guests