Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: TRAPINT doesn't work reliably



On Thu, 2019-09-26 at 14:48 +0000, Dennis Schwartz wrote:
> However, I can only reproduce the bug if I have the following code in my
> `~/.zshrc`:
> 
>     # Antigen zsh plugins
>     if [ -f "/usr/share/zsh-antigen/antigen.zsh" ]; then
>         source "/usr/share/zsh-antigen/antigen.zsh"
> 
>         # load some plugins here, but they are not relevant to trigger
>         # the bug
>     fi
> 
> So, I conditionally `source` another file. Apparently, this is causing
> *super weird* behavior. Unbelievably, if I open the file `.zshrc` (e.g.,
> vim/gedit) and _save_ the file, I cannot trigger the bug. However, if I
> open the file, but _do not save_ the file, I always trigger the bug.

This is very much the sort of weirdness you get with memory errors,
unfortunately.  They're extremely sensitive to what was allocated and
deallocated where --- some piece of memory allocated for one purpose is
presumably being erroneously freed and reused, and as far as the structure of
your zsh code is concerned there's no actual logical relationship between
the places --- they are just getting mixed up in the bowels of the
allocation functions.

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.

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

cheers
pws



Messages sorted by: Reverse Date, Date, Thread, Author