Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15184

Unexpected result of array assignment

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Darren 'Tadgy' Austin <darren@afterdark.org.uk>
Newsgroups gnu.bash.bug
Subject Unexpected result of array assignment
Date Thu, 18 Jul 2019 02:16:41 +0100
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.1618.1563426353.2688.bug-bash@gnu.org> (permalink)
References <nycvar.YAK.7.76.1907180212120.95422@nzl.bcra-fbhepr.pb.hx>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
X-Trace usenet.stanford.edu 1563426353 10561 209.51.188.17 (18 Jul 2019 05:05:53 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
User-Agent Alpine 2.21 (LNX 202 2017-01-01)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x
X-Received-From 83.170.98.46
X-Mailman-Approved-At Thu, 18 Jul 2019 01:05:52 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <nycvar.YAK.7.76.1907180212120.95422@nzl.bcra-fbhepr.pb.hx>
Xref csiph.com gnu.bash.bug:15184

Show key headers only | View raw


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


Thread

Unexpected result of array assignment Darren 'Tadgy' Austin <darren@afterdark.org.uk> - 2019-07-18 02:16 +0100

csiph-web