zsh-users
 help / color / mirror / code / Atom feed
From: Dennis Schwartz <dennis.schwartz@protonmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>,
	"zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: TRAPINT doesn't work reliably
Date: Sat, 28 Sep 2019 18:21:26 +0000	[thread overview]
Message-ID: <XAHZ8eMcWhguYGHAhxgheYNjlPbvjQ3uF0BD81sHbencGnGpsemY3hgPVzZCSeGDGEutJZDp9Rvuk5B_9NczLQXl8YXsAyPuB6jisDzHS-0=@protonmail.com> (raw)
In-Reply-To: <20190928142957.ertue2us5ytn6ooo@tarpaulin.shahaf.local2>

On Saturday, September 28, 2019 2:29 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:

> Okay, so we have another angle on this: we could try to bisect antigen,
> either temporally (between 1.3.4-1 in Debian stretch and 2.2.3-2 in
> Debian buster) or spatially (taking the 2.2.3-2 version and deleting
> half of its antigen.zsh file at a time, lather, rinse, repeat).

Hmm, it seems I'm having difficulties to determine the exact conditions
when this bug occurs. The commands

$ rm -Rf ~/.antigen && git checkout v1.3.4 && make

also triggers the bug using /usr/bin/zsh. I also updated my .zshrc to
source the correct `bin/antigen.zsh` and also run `antigen apply`.

> > > Does removing that assignment make a difference?
> >
> > No, the bug triggers for any TRAPINT function I've tried so far.
>
> Have you tried an empty function, «TRAPINT () {}»?
>
> Is there any reason to also try a «trap ':' INT»?

Both do nothing. It seems like TRAPINT needs to contain at least one
command or a return statement.


On Saturday, September 28, 2019 4:00 PM, Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Sat, Sep 28, 2019 at 4:17 AM Dennis Schwartz
> dennis.schwartz@protonmail.com wrote:
>
> > -   On my system (Debian 10), I need to compile zsh with the version
> >     number from my default Debian installation. So I always do
> >     `git checkout zsh-5.7.1 -- Config/version.mk` before I compile.
> >
>
> So, you should definitely STOP doing that. It's only creating confusion.

Okay, I see why I should avoid doing this. The consequence is that I can
only debug version 5.7.1, either compiled myself (so optionally with
debugging flags set) or using the Debian shipped version.

> I would also suggest that you go back to the configuration where you
> first observed the problem (i.e., do NOT use a custom-compiled binary)
> and start zsh with
>  zsh -o sourcetrace
> which will show you where all the configuration files are being found.
> You can then compare that to "zsh -o sourcetrace" from your newly
> compiled binary to determine which files are the same and which are
> different in the event that the bug behavior changes with the new
> build.

Thanks! That was exactly the command I was looking for. If I return to
my initial setup (i.e., using Debian's shipped zsh and antigen + my
original .zshrc) I get:

$ whence zsh
/usr/bin/zsh
$ touch .zshrc
$ cp .zcompdump zcompdum-pre
$ cp -R .antigen antigen-pre
$ zsh -o sourcetrace
+/etc/zsh/zshenv:1> <sourcetrace>
+/etc/zsh/zshrc:1> <sourcetrace>
+/home/USERNAME/.zshrc:1> <sourcetrace>
+/home/USERNAME/.zcompdump:1> <sourcetrace>
+/usr/share/zsh-antigen/antigen.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/.zcompdump:1> <sourcetrace>
+/home/USERNAME/.antigen/init.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/.zcompdump:1> <sourcetrace>
$ ll 2      <---- indicating the correct behavior of TRAPINT

$ exit
$ cp .zcompdump zcompdum-mid
$ cp -R .antigen antigen-mid
$ zsh -o sourcetrace
+/etc/zsh/zshenv:1> <sourcetrace>
+/etc/zsh/zshrc:1> <sourcetrace>
+/home/USERNAME/.zshrc:1> <sourcetrace>
+/home/USERNAME/.zcompdump:1> <sourcetrace>
+/usr/share/zsh-antigen/antigen.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/init.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/.zcompdump:1> <sourcetrace>
$ ll
TRAPINT:1: not an identifier: F\M-|N)U
$ exit
$ cp .zcompdump zcompdum-post
$ cp -R .antigen antigen-post
$ sha1sum antigen-{pre,mid,post}/**/*
sha1sum: antigen-pre/bundles: Is a directory
ef142d6575f491caf15f643c90abec9809138eff  antigen-pre/debug.log
dbb5aba046583b7e5bd18ff482022e7eb57db6d1  antigen-pre/init.zsh
6a554ac7275ad58b87a484e9be26961ba7bc3bb6  antigen-pre/init.zsh.zwc
sha1sum: antigen-mid/bundles: Is a directory
ab8687454b49cc6d3c55e5d925596cddcbadc342  antigen-mid/debug.log
7f66a86e7d6d7b6847ccd8df0852db90ea40a5af  antigen-mid/init.zsh
6a554ac7275ad58b87a484e9be26961ba7bc3bb6  antigen-mid/init.zsh.zwc
sha1sum: antigen-post/bundles: Is a directory
ab8687454b49cc6d3c55e5d925596cddcbadc342  antigen-post/debug.log
7f66a86e7d6d7b6847ccd8df0852db90ea40a5af  antigen-post/init.zsh
6a554ac7275ad58b87a484e9be26961ba7bc3bb6  antigen-post/init.zsh.zwc
$ sha1sum zcompdum-{pre,mid,post}
2e658e3f3c3c21bec98fedea8390cffd8fdab15e  zcompdum-pre
2e658e3f3c3c21bec98fedea8390cffd8fdab15e  zcompdum-mid
2e658e3f3c3c21bec98fedea8390cffd8fdab15e  zcompdum-post


The only difference between `debug.log` is that `pre` contains less
entries. For `init.zsh`, the only difference is a timestamp in a
comment. I'm a bit lost by these results.


Using the original setup, I can also reproduce the segfault quite
easily:

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/home/USERNAME/.zshrc', 'w').write('function fun() { echo "' + 'a' * (1 << 24) + '" }\nsource "/usr/share/zsh-antigen/antigen.zsh"\nantigen apply')
16777300
>>>
$ rm -Rf .antigen; rm .zcompdump
$ zsh -o sourcetrace
+/etc/zsh/zshenv:1> <sourcetrace>
+/etc/zsh/zshrc:1> <sourcetrace>
+/home/USERNAME/.zshrc:1> <sourcetrace>
+/usr/share/zsh-antigen/antigen.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/init.zsh:1> <sourcetrace>
+/home/USERNAME/.antigen/.zcompdump:1> <sourcetrace>
% exit
$ zsh -o sourcetrace
+/etc/zsh/zshenv:1> <sourcetrace>
+/etc/zsh/zshrc:1> <sourcetrace>
zsh: segmentation fault  zsh -o sourcetrace

Running `cp ~/zshrc-good ~/.zshrc` fixed it again (no need for
`zsh -f`).


I spent several hours on trying to debug this issue again today. This of
course pale into insignificance compared to your time developing zsh
(thanks again!), but I hope you understand that I can only spent some
more time again next weekend. Feel free to ask me to try something to
help debugging though!

Cheers,
Dennis

  reply	other threads:[~2019-09-28 18:22 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
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 [this message]
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='XAHZ8eMcWhguYGHAhxgheYNjlPbvjQ3uF0BD81sHbencGnGpsemY3hgPVzZCSeGDGEutJZDp9Rvuk5B_9NczLQXl8YXsAyPuB6jisDzHS-0=@protonmail.com' \
    --to=dennis.schwartz@protonmail.com \
    --cc=d.s@daniel.shahaf.name \
    --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).