Segmentation fault with associative arrays
Bug #928900 reported by
John Valko
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
If we write code like:
function foo {
declare -A hash
declare hash[foo]=bar #bash crashes here
}
Bash crashes when calling this function. The same exact code works as expected if it's not in a shell function.
Additional details:
$ lsb_release -rd
Description: Ubuntu 11.10
Release: 11.10
$ apt-cache policy bash
bash:
Installed: 4.2-0ubuntu4
Candidate: 4.2-0ubuntu4
Version table:
*** 4.2-0ubuntu4 0
500 http://
100 /var/lib/
Changed in bash (Ubuntu): | |
status: | New → Confirmed |
To post a comment you must log in.
Confirmed with importance: Medium as it is "A bug that has a moderate impact on a core application. "
This script will reproduce (I changed the associative array's key to "baz" to avoid confusion with the function name (foo)).
TEST CASE:
Run the following BASH script:
#!/bin/bash
function foo {
declare -A hash
declare hash[baz]=bar #bash crashes here
}
foo
Expected result:
nothing, but not a crash either
Actual result:
Segmentation fault