Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Grisha Levit Newsgroups: gnu.bash.bug Subject: Re: nounset and $! behavior Date: Mon, 12 Nov 2018 20:17:03 -0500 Lines: 68 Approved: bug-bash@gnu.org Message-ID: References: <7a802601-112b-fea4-6ae9-15d287eb4030@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1542071886 11626 208.118.235.17 (13 Nov 2018 01:18:06 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash To: Chester Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bYopEzYS+fZqOrIerF1zoiYD9rwBVLOufVraW8fP1Ko=; b=AncAlqKbQBiqONHFVloKRc391gov6p+IMk4iHJRdwHP1wdEu4PyIrBWhVN2+a3mxTU 2pXf9n9KtM8D02gkkcRA0I0Z5oh4CJr/HkakJqb05kP4/rErlK4ZJw96V+0YEGSUi2wf UsXOXkifC2QaVPxhRzvJ4h8qI/ogIwuQlmlBZ1wN4sJRHTa3KcPaCfgf62klLo1rD3lc C3+g1X90BjOLxt7jHf4N3ZSdnfh4xHeXT2PQOpewF9trEgVB6ms141HzysEaZjlrb/lk 4p1IdMQK36p4D4Nc7jvNf5TiVru0bVLKWklDcd/YYkiH7VgYfSW+QfmxOFPZxB6qXNBR OH4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bYopEzYS+fZqOrIerF1zoiYD9rwBVLOufVraW8fP1Ko=; b=KKra4pIFvurFGYF9Kd7oBtqe6hc48dYvxWlWEdbZd9MPmvmsyZjTFIPhcLrstK9YNT WfzkyFWMRAyDj/s32tn+W/wZ6/3PW6FZutnBzib8mrXWXMgyY107TtWU1QpONGxcRccg 1SaL2aIrzKWU2ciTSOScDuY65f79q1lm1ih7dWHZpcPGNsTDFcRvYUf6ILOfFR7NLQox q8yu8ac0Wf4KNszZat3YMFHuVzj2FYWUkiNSqfFogmqN1GPl3eCnzjcpM5i5kMPVl/oU /ovS6nrTsNTTe6NcS5xRnPUzyZ1CCkhHqXCTZUe+z7Y/zulK7VWWPB5eaaKV4/9Erhv7 ilFA== X-Gm-Message-State: AGRZ1gKsPbrz2ekg7rJPyHpS6PEnCyrlJCjdK84V2tEJnG/isWX9ErqS e2Inc8ag2n4OBMpGRAqR4BpIpWikklBaqstCENY= X-Google-Smtp-Source: AJdET5evjteLaIwXDKNzWKE9SRkb+kWxfFWJVhKuBNwOrRcyMFWaj/NvVGXQJ/K33OH3rLSeVkNgT3WOzDBuWH5rXa8= X-Received: by 2002:ac8:173d:: with SMTP id w58mr3075055qtj.76.1542071835056; Mon, 12 Nov 2018 17:17:15 -0800 (PST) In-Reply-To: <7a802601-112b-fea4-6ae9-15d287eb4030@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::72c X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14807 > 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=, value="", ind=0, quoted=0, flags=4, varp=, valp=0x00007ffee38d94c8) at subst.c:7409 [opt] frame #3: 0x000000010c37301c bash`parameter_brace_casemod(varname=, value=, ind=, 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=, quoted=, pflags=, quoted_dollar_atp=, contains_dollar_at=) at subst.c:8903 [opt] frame #5: 0x000000010c36f86c bash`param_expand(string=, sindex=0x00007ffee38d983c, quoted=0, expanded_something=, 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=, eflags=) 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=, fds_to_close=) at execute_cmd.c:4296 [opt] frame #10: 0x000000010c340c82 bash`execute_command_internal(command=0x00007fb465e004a0, asynchronous=, pipe_in=-1, pipe_out=-1, fds_to_close=0x00007fb465e004e0) at execute_cmd.c:842 [opt] frame #11: 0x000000010c33e459 bash`execute_command(command=) at execute_cmd.c:394 [opt] frame #12: 0x000000010c329eab bash`reader_loop at eval.c:175 [opt] frame #13: 0x000000010c328fb1 bash`main(argc=, argv=0x00007ffee38d9e30, env=) at shell.c:805 [opt] frame #14: 0x00007fff6e77a08d libdyld.dylib`start + 1