[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
segmentation fault in unset typeset array variable
From: |
Nathan (Acorn) Pooley |
Subject: |
segmentation fault in unset typeset array variable |
Date: |
15 Aug 2004 21:40:22 -0700 |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include
-I./lib -D_GNU_SOURCE -O2 -march=i386 -mcpu=i686 -g
uname output: Linux silverdragon 2.6.5 #5 Tue Apr 27 00:39:37 PDT 2004
i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
If a variable is typeset in a bash function, then unset,
then used with the ${v[@]} syntax it causes a segmentation
violation.
Repeat-By:
Create the following function, then run the function (I
suggest you run this in a subshell by putting it in a
file and then running the file, or else the crash will kill
your terminal session):
bugfunc() {
typeset listvar
unset listvar
echo "${listvar[@]}"
}
bugfunc
Fix:
This is pretty obscure and easily worked around (eg by
just not doing it), but I thought you might be
interested. The segfault only occurs when the variable
is typeset; otherwise there is no problem.
- segmentation fault in unset typeset array variable,
Nathan (Acorn) Pooley <=