Hide Forgot
Description of problem: By entering: function cd() { cd "$@" && pushd "$@"; }; cd /home/${USER} Version-Release number of selected component: bash-4.2.45-1.fc19 Additional info: reporter: libreport-2.1.9 backtrace_rating: 4 cmdline: bash crash_function: __gconv_transform_utf8_internal executable: /usr/bin/bash kernel: 3.11.9-200.fc19.x86_64 runlevel: N 5 type: CCpp uid: 1000 Truncated backtrace: Thread no. 1 (10 frames) #0 __gconv_transform_utf8_internal at ../iconv/skeleton.c:394 #1 __mbrtowc at mbrtowc.c:85 #2 mbrlen at /usr/include/wchar.h:402 #3 string_extract_double_quoted at subst.c:823 #4 expand_word_internal at subst.c:8267 #5 shell_expand_word_list at subst.c:9245 #6 expand_word_list_internal at subst.c:9362 #7 expand_words at subst.c:8984 #8 execute_simple_command at execute_cmd.c:3787 #9 execute_command_internal at execute_cmd.c:747
Created attachment 829688 [details] File: backtrace
Created attachment 829689 [details] File: cgroup
Created attachment 829690 [details] File: core_backtrace
Created attachment 829691 [details] File: dso_list
Created attachment 829692 [details] File: environ
Created attachment 829693 [details] File: exploitable
Created attachment 829694 [details] File: limits
Created attachment 829695 [details] File: maps
Created attachment 829696 [details] File: open_fds
Created attachment 829697 [details] File: proc_pid_status
Created attachment 829698 [details] File: var_log_messages
This is an ALMOST intended behaviour since the command "function foo () { ; }" is not posixly correct. The correct form is either "function foo { ; }" OR "foo () { ; }". Both have slightly different behaviour, but function foo () is so common that bash doesn't emit any warnings. With the correct syntax, you would get: "cd: maximum nested function level reached". However, letting bash get SIGSEGV-ed, even with a non 100% posix-compliant shell script is a tiny bit extreme. What bash does exactly is smashing it's own stack by infinite recursion. I'll talk to upstream about this. Thank you for the report.
The offical upstream statement is that this works as intended. You can set the FUNCNEST environment variable to control the maximum recursion depth. However, stack size is still the hard limit, setting FUNCNEST doesn't ensure you'll be able to recurse as deeply as you'd like.