Bug 1207803

Summary: wrong parsing inside for loop and brackets
Product: Red Hat Enterprise Linux 6 Reporter: Petr Stodulka <pstodulk>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: unspecified Docs Contact: Petr Bokoc <pbokoc>
Priority: unspecified    
Version: 6.7CC: dkutalek, ovasik, pbokoc, svashisht
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: bash-4.1.2-40.el6 Doc Type: Bug Fix
Doc Text:
Command substitution now works inside arithmetic expressions in *bash* Previously, *bash* did not save input line state across recursive calls to the shell parser, causing the shell to fail to parse command substitution inside arithmetic expressions. For example, the following command failed: for point in "/boot"; do disk_dir["$( df -P $point | awk '{print $1}' )"]=1; done This bug has been fixed, *bash* now saves input line state before making recursive calls to the parser, and command substitution now works inside arithmetic expressions.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 20:50:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1254457    

Description Petr Stodulka 2015-03-31 18:27:03 UTC
Description of problem:
Wrong parsing inside for cycle when associative array is used with substitution inside brackets.

How reproducible:
Always with old bash version 4.1.2.

Steps to Reproduce:
$ for point in "/boot"; do disk_dir["$( df -P $point | awk '{print $1}' )"]=1; done


Additional info:
$rpm -q bash
bash-4.1.2-33.el6.x86_64

I can't reproduce it with version 4.3.33 on Fedora 21.

Comment 1 Ondrej Oprala 2015-07-07 09:35:03 UTC
This seems to be fixed by bash42-053...backport shouldn't be a problem.

Comment 9 Siteshwar Vashisht 2016-04-28 09:22:49 UTC
This was actually fixed by backporting bash42-012 (and not bash42-053 as mentioned in comment#1).

Comment 13 errata-xmlrpc 2016-05-10 20:50:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0800.html