[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash 4 crash: "f(){ declare -a x;declare -A x;};f"
From: |
Mark |
Subject: |
Bash 4 crash: "f(){ declare -a x;declare -A x;};f" |
Date: |
Tue, 12 Feb 2019 22:46:50 -0700 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include
-I./lib -g -O2 -Wno-parentheses -Wno-format-security
uname output: Linux skami 4.19.12-1-CHAKRA #1 SMP PREEMPT Fri Dec 28
13:42:52 CET 2018 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.4
Patch Level: 18
Release Status: release
Description:
Bash versions 4.0 thru 4.4.18 crash when declaring a variable as an
indexed array and then as an associative array while inside of a
function.
Note that the opposite declaration order doesn't cause a crash, and
neither does the same thing outside of a function. Also, other
things can happen inside the function before the crash; it
ultimately crashes on function return.
Repeat-By:
Run this code in a Bash 4.x shell that you don't don't mind
crashing. "f() { declare -a x; declare -A x; }; f"
Fix:
Get everyone to upgrade to Bash 5.0, which is unaffected.
- Bash 4 crash: "f(){ declare -a x;declare -A x;};f",
Mark <=