Bug 1074202

Summary: Regression in variable nesting
Product: [Fedora] Fedora Reporter: Zdenek Kabelac <zkabelac>
Component: bashAssignee: Ondrej Oprala <ooprala>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, ooprala, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-01 08:52:07 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:
Embargoed:

Description Zdenek Kabelac 2014-03-08 21:14:27 UTC
Description of problem:

Here is simple bash script which used to work in pre 4.3 era:
(Noticed from failing lvm2 test suite)

--

#!/bin/bash

pass_() {
	declare -a var=("${!1}")
	echo "Size ${#var[*]}"
	printf "%s\n" "${var[@]}"
}

var=( "a" )
pass_ "var[@]"

--
Output with 4.3:
Size 0

--
Output with bash-4.2.45-6.fc21.x86_64
Size 1
a
--

Obvious workaround is to use different name with 'declare -a var'
but looks like serious regression in variable name processing in bash


Version-Release number of selected component (if applicable):
bash-4.3.0-1.fc21.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Ondrej Oprala 2014-03-10 10:55:13 UTC
Thank you for reporting this. A similar issue (if I'm not mistaken) was already reported on the upstream ML - http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00049.html . It doesn't seem like a deliberate regression, so hopefully it'll catch their attention soon.

Comment 2 Ondrej Oprala 2014-04-01 08:52:07 UTC
Although a regression, this now seems to be the correct behaviour and won't be changed back. Please see [1] for a solution/rationale of this problem.

[1] http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00052.html