Your message dated Sun, 7 Apr 2024 13:20:48 +0200
with message-id <[email protected]>
and subject line Re: Bug#553695: bash: associative array causes crash on 
assignment
has caused the Debian Bug report #553695,
regarding bash: associative array causes crash on assignment
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
553695: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553695
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bash
Version: 4.0-4
Severity: normal


When attemtping to assign to an associative array, bash crashed and
rendered the pty unusable. The following is a cut-and-paste from the
bash session:

    $ declare -A foo
    $ foo=(dir=$HOME)

    malloc: ../bash/hashlib.c:306: assertion botched
    free: called with unallocated block argument
    last command: foo=(dir=$HOME)
    Aborting...

    Warning: Program '/bin/bash' crashed.

Expected behavior is for foo["dir"] to equal the expanded value of
$HOME. Perhaps more importantly, expected behavior is that bash handle
the error more gracefully.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (700, 'unstable'), (600, 'stable'), (550, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files                5.0.0          Debian base system miscellaneous f
ii  debianutils               3.2.1          Miscellaneous utilities specific t
ii  libc6                     2.9-25         GNU C Library: Shared libraries
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand

Versions of packages bash recommends:
ii  bash-completion               1:1.0-3    programmable completion for the ba

Versions of packages bash suggests:
pn  bash-doc                      <none>     (no description available)

-- no debconf information



--- End Message ---
--- Begin Message ---
Version:5.0-6

On Sun, 01 Nov 2009 14:28:30 -0800 "Todd A. Jacobs" <[email protected]> wrote:
When attemtping to assign to an associative array, bash crashed and
rendered the pty unusable. The following is a cut-and-paste from the
bash session:

    $ declare -A foo
    $ foo=(dir=$HOME)

    malloc: ../bash/hashlib.c:306: assertion botched
    free: called with unallocated block argument
    last command: foo=(dir=$HOME)
    Aborting...

    Warning: Program '/bin/bash' crashed.

Hi, the crash no longer happen in bash version 5.0-6.

However that syntax is wrong. You can either use

    $ foo=(dir $HOME)

or

    $ foo=([dir]=$HOME)

https://www.gnu.org/software/bash/manual/html_node/Arrays.html

When assigning to an associative array, the words in a compound
assignment may be either assignment statements, for which the
subscript is required, or a list of words that is interpreted as a
sequence of alternating keys and values: name=(key1 value1 key2
value2 … ). These are treated identically to name=( [key1]=value1
[key2]=value2 … ).
If you use foo=(aaa=bbb) you're setting the first element of the foo array to the literal value "aaa=bbb".

Regards,

--
Gioele Barabucci

--- End Message ---

Reply via email to