Bug 286861 - Wrong input confuses bash's arithmetic unit permanently
Wrong input confuses bash's arithmetic unit permanently
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
7
All Linux
high Severity high
: ---
: ---
Assigned To: Tomas Janousek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-11 16:17 EDT by Enrico Scholz
Modified: 2008-01-11 17:04 EST (History)
1 user (show)

See Also:
Fixed In Version: 3.2-19.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-11 17:04:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2007-09-11 16:17:48 EDT
Description of problem:

$ i=0
$ let ++i
$ echo $i
1

$ let tmp="foo.a"+0
bash: let: tmp=foo.a+0: syntax error: invalid arithmetic...

$ i=0
$ let ++i
$ echo $i
0

--> every further use of 'let' will generate bogus results. bash-3.1 returns
expected results.


Version-Release number of selected component (if applicable):

bash-3.2-9.fc7


How reproducible:

100%
Comment 1 Enrico Scholz 2007-09-12 03:12:47 EDT
upstream report at http://article.gmane.org/gmane.comp.shells.bash.bugs/10506
Comment 2 Pete Graner 2007-09-12 09:12:50 EDT
You can get around it short term by using POSIX syntax:

i=$(( $i + 1 ))

I'm looking to see what changed between 3.1 & 3.2 and go from there.
Comment 3 Enrico Scholz 2007-09-12 09:34:57 EDT
no; same happens with pure POSIX expressions:

$ : $(( tmp=foo.a+0 )) 
bash: tmp=foo.a+0 : syntax error: invalid arithmetic... 
$ i=0 ; : $(( ++i )) ; echo $i 
0 


Patch 20 seems to fix related errors but I did not tested recent version yet.
Comment 4 Tomas Janousek 2007-11-06 07:27:24 EST
I debugged it and found the cause, let's see what upstream thinks about my
proposed solution:
http://article.gmane.org/gmane.comp.shells.bash.bugs/10729
Comment 5 Tomas Janousek 2007-11-12 12:46:56 EST
Should be fixed in bash-3.2-19.fc9, I'll release f7 update sooner or later.
Comment 6 Fedora Update System 2007-11-28 20:32:38 EST
bash-3.2-19.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bash'
Comment 7 Fedora Update System 2007-11-28 20:37:08 EST
bash-3.2-19.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bash'
Comment 8 Fedora Update System 2008-01-11 17:04:21 EST
bash-3.2-19.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 9 Fedora Update System 2008-01-11 17:04:57 EST
bash-3.2-19.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.