Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14807

Re: nounset and $! behavior

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Grisha Levit <grishalevit@gmail.com>
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 <mailman.3954.1542071885.1284.bug-bash@gnu.org> (permalink)
References <CAMu=Brpc6TJWFmc4nvsm1H--miaSuCZ8yOTxctZbJ8yvmVBw-Q@mail.gmail.com> <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 <bug-bash@gnu.org>
To Chester Ramey <chet.ramey@case.edu>
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 <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14807

Show key headers only | View raw


> 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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: nounset and $! behavior Grisha Levit <grishalevit@gmail.com> - 2018-11-12 20:17 -0500

csiph-web