Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15184
| From | Darren 'Tadgy' Austin <darren@afterdark.org.uk> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Unexpected result of array assignment |
| Date | 2019-07-18 02:16 +0100 |
| Message-ID | <mailman.1618.1563426353.2688.bug-bash@gnu.org> (permalink) |
| References | <nycvar.YAK.7.76.1907180212120.95422@nzl.bcra-fbhepr.pb.hx> |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-LQgi2O/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security
uname output: Linux phil 5.0.0-13-generic #14-Ubuntu SMP Mon Apr 15 14:59:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
There seems to be unexpect (a bug?) behaviour with bash's handling of array assignments.
Specifically, if you try to assign an array element a value containing that same array value, it fails to work.
See example below :)
Bug confirmed by the folks in #bash on Freenode - unable to explain what is happening.
Repeat-By:
declare -A foo
foo=(["key"]="value1")
declare -p foo
foo=(["key"]="${foo["key"]} value2")
declare -p foo
The above should result in 'foo["key"]' having a value of 'value1 value2', but the result is simply ' value2', which I believe to be incorrect behaviour.
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Unexpected result of array assignment Darren 'Tadgy' Austin <darren@afterdark.org.uk> - 2019-07-18 02:16 +0100
csiph-web