Bug 286861 - Wrong input confuses bash's arithmetic unit permanently
Summary: Wrong input confuses bash's arithmetic unit permanently
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 7
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Tomas Janousek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-11 20:17 UTC by Enrico Scholz
Modified: 2008-01-11 22:04 UTC (History)
1 user (show)

Fixed In Version: 3.2-19.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-11 22:04:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Enrico Scholz 2007-09-11 20:17:48 UTC
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 07:12:47 UTC
upstream report at http://article.gmane.org/gmane.comp.shells.bash.bugs/10506

Comment 2 Pete Graner 2007-09-12 13:12:50 UTC
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 13:34:57 UTC
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 12:27:24 UTC
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 17:46:56 UTC
Should be fixed in bash-3.2-19.fc9, I'll release f7 update sooner or later.

Comment 6 Fedora Update System 2007-11-29 01:32:38 UTC
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-29 01:37:08 UTC
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 22:04:21 UTC
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 22:04:57 UTC
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.