From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c3f2a01d for ; Thu, 26 Sep 2019 17:11:51 +0000 (UTC) Received: (qmail 17202 invoked by alias); 26 Sep 2019 17:11:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24293 Received: (qmail 29118 invoked by uid 1010); 26 Sep 2019 17:11:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-40130.protonmail.ch by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25580. spamassassin: 3.4.2. Clear:RC:0(185.70.40.130):SA:0(-2.7/5.0):. Processed in 4.107682 secs); 26 Sep 2019 17:11:41 -0000 X-Envelope-From: dennis.schwartz@protonmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.protonmail.ch designates 185.70.40.130 as permitted sender) Date: Thu, 26 Sep 2019 17:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1569517856; bh=WXUEkpPhxmERv7J93MNitTF9rpJjStosk2X/vhE49Ec=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=NE0T9Mnp2JzRdE79uVbo2GzjcsWGT522nv7JaFj9CDRoPa60iJjg76Fto8esX6Cjw xvzz6MQw3xTW6FE3PpS/9CKav31I+XLacgNnjDs9K5rOeHQgU065GFImoszNlxTbhW zHiyGEeVcVqxFdrCmMARUKZb+Gxi/LkQHpok51bg= To: Peter Stephenson From: Dennis Schwartz Cc: "zsh-users@zsh.org" Reply-To: Dennis Schwartz Subject: Re: TRAPINT doesn't work reliably Message-ID: <7P_7qK1o03NLAWi2yO8YMPN4ErtxVF9fCDTtiPNjfRrzqKcmoysqAeR8nQ1B5DEY_uYE_Y6EBGsxysbflCAyLbm_h5qrobU4F0143UCxWW8=@protonmail.com> In-Reply-To: <1569511539.3770.6.camel@samsung.com> References: <1569314663.5531.4.camel@samsung.com> <1394985674.3969083.1569420087673@mail2.virginmedia.com> <22AgAhXQWzavJGhNA8tFbGSMGk8z3KDGGa-pICX0lWszH622z2_nnc1acuvW3OcIbqAaXM_WAGJwmQU5Oph83DGbfQEplu1t3o7F5omeC4w=@protonmail.com> <1569434163.10786.26.camel@samsung.com> <1569511539.3770.6.camel@samsung.com> Feedback-ID: 9o-Cl1kmi7SjXhHVTYCKLMaOWEb5sehZHGWJCh5kD69wcWVVeOfY5BYq3wMUF0ymJu-oBC8u1h80JJ91GEz6Og==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thursday, September 26, 2019 5:25 PM, Peter Stephenson 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=3D"$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=3Dfull --log-file=3Dzsh-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