zsh-users
 help / color / mirror / code / Atom feed
From: Dennis Schwartz <dennis.schwartz@protonmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: TRAPINT doesn't work reliably
Date: Thu, 26 Sep 2019 17:10:54 +0000	[thread overview]
Message-ID: <7P_7qK1o03NLAWi2yO8YMPN4ErtxVF9fCDTtiPNjfRrzqKcmoysqAeR8nQ1B5DEY_uYE_Y6EBGsxysbflCAyLbm_h5qrobU4F0143UCxWW8=@protonmail.com> (raw)
In-Reply-To: <1569511539.3770.6.camel@samsung.com>

On Thursday, September 26, 2019 5:25 PM, Peter Stephenson <p.stephenson@samsung.com> wrote:

> It suggests it's going to be quite hard to reproduce elsewhere, though
> I'd still be interesting in the logic where you're defining TRAPINT since
> clearly that's the memory that's getting mishandled.

I don't fully understand what you mean with "the logic where you're
defining TRAPINT," but I have the following code in my `.zshrc`:

    function TRAPINT {
        VIMODE="$VIINS"
        print $1  # for debug only
        return $(( 128 + $1 ))
    }

(I use zsh with vi keybindings and VIMODE indicates on my prompt which
mode I'm in. When I interrupt, start again in insert mode and I want that
to be properly indicated.)


> It's also still suggesting trying to get valgrind to give a bit more
> detail is the best way forward.

Ah, of course. I forgot about valgrind since I could only reproduce this
bug if I checked out the tag `zsh-5.7.1`.

I did manage to capture the bug with valgrind on `master` using the
following sequence of commands (output tidied):

$ git checkout master
$ git checkout zsh-5.7.1 -- Config/version.mk
$ ./configure --enable-zsh-debug && make && sudo make install
$ valgrind --leak-check=full --log-file=zsh-valgrind.log /usr/local/bin/zsh
/usr/share/zsh-antigen/antigen.zsh:2134: parse error near `\n'
$ ll
TRAPINT:1: not an identifier:

Here, `ll [TAB]` was executed in the new shell. I don't get the error
message "/usr/share/zsh-antigen/antigen.zsh:2134: parse error near `\n'"
when I start zsh without valgrind, so I guess that can be ignored.


What valgrind captured:

Invalid read of size 1
   at 0x4838CC2: __strlen_sse2 (vg_replace_strmem.c:462)
   by 0x1B0792: dupstring (string.c:39)
   by 0x19BC70: ecgetstr (parse.c:2809)
   by 0x144095: addvars (exec.c:2429)
   by 0x1404DB: execsimple (exec.c:1237)
   by 0x140A85: execlist (exec.c:1378)
   by 0x14038F: execode (exec.c:1194)
   by 0x14DCB0: runshfunc (exec.c:5980)
   by 0x14D2E8: doshfunc (exec.c:5830)
   by 0x1AF4D1: dotrapargs (signals.c:1371)
   by 0x1AFA8F: dotrap (signals.c:1487)
   by 0x1AF18C: handletrap (signals.c:1202)
 Address 0x566b948 is 0 bytes after a block of size 328 free'd
   at 0x48369AB: free (vg_replace_malloc.c:530)
   by 0x13D8F3: zcontext_restore_partial (context.c:108)
   by 0x13DA56: zcontext_restore (context.c:119)
   by 0x175A04: parse_subscript (lex.c:1697)
   by 0x18B7F1: getindex (params.c:1858)
   by 0x18C132: fetchvalue (params.c:2106)
   by 0x1B6304: paramsubst (subst.c:2516)
   by 0x1B1DB9: stringsubst (subst.c:322)
   by 0x1B1108: prefork (subst.c:142)
   by 0x14486C: execsubst (exec.c:2570)
   by 0x1772E9: execfor (loop.c:98)
   by 0x148469: execcmd_exec (exec.c:3913)
 Block was alloc'd at
   at 0x483577F: malloc (vg_replace_malloc.c:299)
   by 0x13D5D6: zcontext_save_partial (context.c:58)
   by 0x13D7E9: zcontext_save (context.c:82)
   by 0x1758A7: parse_subscript (lex.c:1661)
   by 0x18B7F1: getindex (params.c:1858)
   by 0x18C132: fetchvalue (params.c:2106)
   by 0x1B6304: paramsubst (subst.c:2516)
   by 0x1B1DB9: stringsubst (subst.c:322)
   by 0x1B1108: prefork (subst.c:142)
   by 0x14486C: execsubst (exec.c:2570)
   by 0x1772E9: execfor (loop.c:98)
   by 0x148469: execcmd_exec (exec.c:3913)


I hope this helps. Thank you for your time and developing zsh!

Cheers,
Dennis

  reply	other threads:[~2019-09-26 17:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190917164905epcas1p4ad458ffcd504501780d522880c81de3e@epcas1p4.samsung.com>
2019-09-17 16:47 ` Dennis Schwartz
2019-09-24  8:44   ` Peter Stephenson
2019-09-25 13:02     ` Dennis Schwartz
2019-09-25 14:01       ` Peter Stephenson
2019-09-25 16:25         ` Dennis Schwartz
2019-09-25 17:04           ` Peter Stephenson
2019-09-25 18:46             ` Daniel Shahaf
2019-09-26 15:27               ` Peter Stephenson
2019-09-27 13:43                 ` Daniel Shahaf
2019-09-25 17:56           ` Peter Stephenson
2019-09-26 14:48             ` Dennis Schwartz
2019-09-26 15:25               ` Peter Stephenson
2019-09-26 17:10                 ` Dennis Schwartz [this message]
2019-09-27 13:46                   ` Daniel Shahaf
2019-09-28 11:16                     ` Dennis Schwartz
2019-09-28 14:29                       ` Daniel Shahaf
2019-09-28 18:21                         ` Dennis Schwartz
2019-09-28 18:58                           ` Dennis Schwartz
2019-09-28 16:00                       ` Bart Schaefer
2019-09-29 16:54                         ` Peter Stephenson
2019-09-27 19:05                   ` Peter Stephenson

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='7P_7qK1o03NLAWi2yO8YMPN4ErtxVF9fCDTtiPNjfRrzqKcmoysqAeR8nQ1B5DEY_uYE_Y6EBGsxysbflCAyLbm_h5qrobU4F0143UCxWW8=@protonmail.com' \
    --to=dennis.schwartz@protonmail.com \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-users@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).