zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [BUG] Crash related to alias completion in arithmetic construct
Date: Thu, 20 Sep 2018 17:47:47 -0500	[thread overview]
Message-ID: <377F5A63-9332-40EC-B242-181DF0326AA8@dana.is> (raw)

A co-worker was trying to perform a calculation using a bunch of nested command
substitutions within an arithmetic construct and he reported to me that the
shell segfaulted on him. He waited a day or two to tell me about it, and i guess
his history was lost, so i'm still trying to piece together what he was actually
doing, but i think i found possibly two issues.

If i can narrow down the original problem he was having i'll send another
report, but here's one that i encountered by accident during troubleshooting:

  # OK
  % echo $(( $(foo)^D

  # OK
  % alias foo=:
  % echo $(( $(foo)^D

  # Crash
  % alias foo=': -x'
  % echo $(( $(foo)^D
  zsh: segmentation fault

I replicated this on 5.4.2 (Linux) and master (macOS). The ^D here is trying to
list completion possibilities, so you need the requisite set-up for that.

Back-trace from 5.4.2:

#0  hrealloc (p=0x562a558d31c0 " \205\210foo: Й\231U*V", old=8, new=new@entry=16) at ../../Src/mem.c:726
        h = <optimized out>
        ph = <optimized out>
#1  0x0000562a54b2b663 in zshlex_raw_add (c=c@entry=32) at ../../Src/lex.c:1937
        newbsiz = 16
#2  0x0000562a54b20f5a in ingetc () at ../../Src/input.c:232
        lastc = 32
#3  0x0000562a54b29069 in gettokstr (c=c@entry=58, sub=sub@entry=0) at ../../Src/lex.c:1380
        act = <optimized out>
        e = <optimized out>
        inbl = <optimized out>
        bct = <optimized out>
        pct = 0
        brct = 0
        seen_brct = 0
        fdpar = 0
        intpos = 1
        in_brace_param = 0
        inquote = <optimized out>
        unmatched = 0
        peek = STRING
#4  0x0000562a54b2a9e4 in gettok () at ../../Src/lex.c:908
        c = 58
        d = <optimized out>
        peekfd = -1
        peek = <optimized out>
        c = <optimized out>
        d = <optimized out>
        peekfd = <optimized out>
        peek = <optimized out>
        e = <optimized out>

dana


                 reply	other threads:[~2018-09-20 22:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=377F5A63-9332-40EC-B242-181DF0326AA8@dana.is \
    --to=dana@dana.is \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).