bug-bash
[Top][All Lists]
Advanced

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

Re: nounset and $! behavior


From: Grisha Levit
Subject: Re: nounset and $! behavior
Date: Mon, 12 Nov 2018 20:17:03 -0500

> How does it `crash bash'?

Sorry, should have specified.  I get the following backtrace (but only
after doing the second expansion).

$ env -i $BASH --norc -iuc $'echo ${!,} \n echo ${!,}'; echo $?
bash: $!: unbound variable
bash: !: unbound variable
bash: $!: unbound variable
139

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
    frame #0: 0x00007fff6e960712 libsystem_platform.dylib`_platform_strlen
+ 18
libsystem_platform.dylib`_platform_strlen:
->  0x7fff6e960712 <+18>: pcmpeqb (%rdi), %xmm0
    0x7fff6e960716 <+22>: pmovmskb %xmm0, %esi
    0x7fff6e96071a <+26>: andq   $0xf, %rcx
    0x7fff6e96071e <+30>: orq    $-0x1, %rax
Target 0: (bash) stopped.
bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
  * frame #0: 0x00007fff6e960712 libsystem_platform.dylib`_platform_strlen
+ 18
    frame #1: 0x000000010c36933e bash`dequote_escapes(string="") at
subst.c:4104 [opt]
    frame #2: 0x000000010c3748b5
bash`get_var_and_type(varname=<unavailable>, value="", ind=0, quoted=0,
flags=4, varp=<unavailable>, valp=0x00007ffee38d94c8) at subst.c:7409 [opt]
    frame #3: 0x000000010c37301c
bash`parameter_brace_casemod(varname=<unavailable>, value=<unavailable>,
ind=<unavailable>, modspec=126, patspec="", quoted=0, pflags=0, flags=4) at
subst.c:8310 [opt]
    frame #4: 0x000000010c36fa6d bash`param_expand [inlined]
parameter_brace_expand(string=<unavailable>, quoted=<unavailable>,
pflags=<unavailable>, quoted_dollar_atp=<unavailable>,
contains_dollar_at=<unavailable>) at subst.c:8903 [opt]
    frame #5: 0x000000010c36f86c bash`param_expand(string=<unavailable>,
sindex=0x00007ffee38d983c, quoted=0, expanded_something=<unavailable>,
contains_dollar_at=0x00007ffee38d9804,
quoted_dollar_at_p=0x00007ffee38d9800,
had_quoted_null_p=0x00007ffee38d9824, pflags=0) at subst.c:9384 [opt]
    frame #6: 0x000000010c366e2a
bash`expand_word_internal(word=0x00007fb465f09bf0, quoted=0, isexp=0,
contains_dollar_at=0x00007ffee38d9a00,
expanded_something=0x00007ffee38d9a04) at subst.c:9953 [opt]
    frame #7: 0x000000010c36c3eb bash`expand_word_list_internal [inlined]
shell_expand_word_list(tlist=0x0000000000000000, eflags=0) at subst.c:11298
[opt]
    frame #8: 0x000000010c36c1ea
bash`expand_word_list_internal(list=<unavailable>, eflags=<unavailable>) at
subst.c:11422 [opt]
    frame #9: 0x000000010c340fb6 bash`execute_command_internal [inlined]
execute_simple_command(simple_command=0x00007fb465e004c0, pipe_in=-1,
pipe_out=-1, async=<unavailable>, fds_to_close=<unavailable>) at
execute_cmd.c:4296 [opt]
    frame #10: 0x000000010c340c82
bash`execute_command_internal(command=0x00007fb465e004a0,
asynchronous=<unavailable>, pipe_in=-1, pipe_out=-1,
fds_to_close=0x00007fb465e004e0) at execute_cmd.c:842 [opt]
    frame #11: 0x000000010c33e459
bash`execute_command(command=<unavailable>) at execute_cmd.c:394 [opt]
    frame #12: 0x000000010c329eab bash`reader_loop at eval.c:175 [opt]
    frame #13: 0x000000010c328fb1 bash`main(argc=<unavailable>,
argv=0x00007ffee38d9e30, env=<unavailable>) at shell.c:805 [opt]
    frame #14: 0x00007fff6e77a08d libdyld.dylib`start + 1


reply via email to

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