bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SIGSEGV on "local -a GROUPS=(...)" in function


From: Richard Tollerton
Subject: SIGSEGV on "local -a GROUPS=(...)" in function
Date: Thu, 14 Feb 2013 18:57:51 -0600
User-agent: Mutt/1.5.21+128 (bf84f24e512d) (2012-12-30)

This is probably not a good thing to be doing in the first place (I ran
into this before realizing that GROUPS was a special variable):

#!/bin/bash
crashy () { local -a GROUPS=(a b); }
crashy

But it probably shouldn't be doing this (tested in bash 4.2.42 on
archlinux x86_64, and bash 4.2.10 on armv7a):

$ ./bash-crash.sh 
Segmentation fault (core dumped)

Here's a stack trace:

(gdb) run ~/bash-crash.sh
Starting program: /home/rtollert/abs/bash/src/bash-4.2/bash ~/bash-crash.sh
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGSEGV, Segmentation fault.
assign_compound_array_list (address@hidden, address@hidden, address@hidden)
    at arrayfunc.c:516
516           else if (assoc_p (var))
(gdb) bt
#0  assign_compound_array_list (address@hidden, address@hidden, address@hidden)
    at arrayfunc.c:516
#1  0x0000000000442210 in do_compound_assignment (flags=2, value=0x6e7980 "a 
b", 
    name=0x6e7960 "GROUPS") at subst.c:2715
#2  do_assignment_internal (word=<optimized out>, address@hidden) at 
subst.c:2815
#3  0x0000000000442315 in do_word_assignment (word=<optimized out>, 
address@hidden)
    at subst.c:2866
#4  0x000000000044878c in shell_expand_word_list (eflags=31, tlist=0x6e7880) at 
subst.c:9230
#5  expand_word_list_internal (list=<optimized out>, address@hidden) at 
subst.c:9362
#6  0x0000000000448d75 in expand_words (list=<optimized out>) at subst.c:8984
#7  0x0000000000429acb in execute_simple_command (fds_to_close=<optimized out>, 
    async=<optimized out>, pipe_out=-1, pipe_in=-1, simple_command=0x6e72d0) at 
execute_cmd.c:3775
#8  execute_command_internal (command=<optimized out>, address@hidden, 
    address@hidden, address@hidden, address@hidden)
    at execute_cmd.c:735
#9  0x000000000042b8f6 in execute_command_internal (address@hidden, 
    address@hidden, address@hidden, address@hidden, 
    address@hidden) at execute_cmd.c:883
#10 0x000000000042c498 in execute_function (address@hidden, address@hidden, 
    address@hidden, address@hidden, address@hidden, 
    address@hidden) at execute_cmd.c:4306
#11 0x000000000042a33b in execute_builtin_or_function (flags=0, 
fds_to_close=0x6e55b0, redirects=0x0, 
    var=0x6e6fe0, builtin=0x0, words=0x6e6c60) at execute_cmd.c:4536
#12 execute_simple_command (fds_to_close=<optimized out>, async=<optimized 
out>, pipe_out=-256, 
    pipe_in=0, simple_command=0x0) at execute_cmd.c:3944
#13 execute_command_internal (address@hidden, address@hidden, 
    address@hidden, address@hidden, address@hidden)
    at execute_cmd.c:735
#14 0x000000000042d642 in execute_command (command=0x6e5580) at 
execute_cmd.c:382
#15 0x000000000041926e in reader_loop () at eval.c:152
#16 0x0000000000418d50 in main (argc=2, argv=0x7fffffffe358, 
env=0x7fffffffe370) at shell.c:749




reply via email to

[Prev in Thread] Current Thread [Next in Thread]