zsh-autosuggestions causing zsh to unexpectedly quit with ┃

Created on 5 Apr 2017  ·  7Comments  ·  Source: zsh-users/zsh-autosuggestions

__Versions:__

zsh 5.3.1 (x86_64-apple-darwin14.5.0)

zsh-autosuggestions: 40b96f6cfda900297d8e8c923d6f637f1e37c9f5

__Steps to Reproduce:__

  1. Configure .zshrc
source ~/.zplug/init.zsh
zplug 'zsh-users/zsh-autosuggestions', at:develop
zplug load
  1. Run the following on command line
echo "┃"
  1. Type the follow on command line
e
  1. Crash
bug reproduced wontfix

All 7 comments

Im encounting almost same problem by another UTF-8 characters.
I guess this is a problem around zsh history and utf-8( or another encondig. anyway pure-ANSI command succeed everytime).

I found the problem commit that causes this bug.

$ git bisect log
# bad: [40b96f6cfda900297d8e8c923d6f637f1e37c9f5] Merge pull request #223 from zsh-users/fixes/bpm_async_fix
# good: [9cfaf5d3424ceb5fedd2c7e3253f823faae74383] v0.3.3
git bisect start 'develop' 'v0.3.3'
# bad: [5151adfe400c8a0ccefe7a4f440ae0fb6f5f67a0] Make TerminalSession#clear block until the screen is cleared
git bisect bad 5151adfe400c8a0ccefe7a4f440ae0fb6f5f67a0
# bad: [ab2742537f248f6c807535db7fa121157c593990] Quote the suggestion to support sh_split_word option
git bisect bad ab2742537f248f6c807535db7fa121157c593990
# good: [ab8f29522522007fa22266538af7ef19e2331fa6] First pass at async functionality
git bisect good ab8f29522522007fa22266538af7ef19e2331fa6
# good: [e33eb570c461e4f0c97d7ce1f2c33a15f2a200b7] Send only the prefix to the suggestion server
git bisect good e33eb570c461e4f0c97d7ce1f2c33a15f2a200b7
# bad: [b530b0c99679c00a5234c25f0adfa0d70a522900] Use `zpty -r` with pattern matching to fetch suggestion
git bisect bad b530b0c99679c00a5234c25f0adfa0d70a522900
# good: [5c891afd48e3c27faaff86f988816b11fe499dde] Reset zsh options inside pty (from zsh-async)
git bisect good 5c891afd48e3c27faaff86f988816b11fe499dde
# first bad commit: [b530b0c99679c00a5234c25f0adfa0d70a522900] Use `zpty -r` with pattern matching tofetch suggestion

Commit https://github.com/zsh-users/zsh-autosuggestions/commit/b530b0c99679c00a5234c25f0adfa0d70a522900 causes this problem.

I'm struggling to fix this problem ongoingly.

P.S1

https://github.com/zsh-users/zsh-autosuggestions/blob/b530b0c99679c00a5234c25f0adfa0d70a522900/zsh-autosuggestions.zsh#L507
The problem is this line. It causes zsh shell crash.

P.S2

After 2 hours struggle, I gave up to make a pull request to fix this problem, because I'm lacking zsh(zpty) study to do that.
Now I decide to pin autosuggestion version v0.3.3 and watching this issue page until It solved.

Thanks for reporting this. I played with it a little bit and couldn't immediately reproduce (zsh 5.3.1 (x86_64-apple-darwin15.6.0)).

You mentioned that you were working on a pull request to fix the issue. If you could first focus on writing an test case that reproduces the issue it would be greatly appreciated. Would probably belong in special_characters_spec.rb.

Another thing to try would be sourcing the plugin by itself (loading nothing else via zshrc). You can use zsh -f to start a zsh session without sourcing .zshrc. Then source the z-asug file itself manually and try to reproduce.

It looks like my issue was caused by an older version of zsh, zsh 5.0.5 (x86_64-apple-darwin14.0).

In my .tmux.conf I had

set-option -g default-shell /bin/zsh

where

❯ /bin/zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)

when I should of had

set-option -g default-shell /usr/local/bin/zsh

which has a newer version of zsh

❯ /usr/local/bin/zsh --version
zsh 5.3.1 (x86_64-apple-darwin14.5.0)

Also, iTerm was setup to use /bin/zsh as well...
screenshot 2017-04-18 16 36 29

I think I find zsh bug report relating this problem and fix commit https://github.com/zsh-users/zsh/commit/a5233fd01e9ab4953b7ff8b4cc031485b414b8e3 .

Firstly I checked some OS and zsh version with this problem.

  • zsh 5.2 (x86_64-ubuntu-linux-gnu) on ubuntu 17.04 : crashed
  • zsh 5.3.1 (x86_64-apple-darwin14.5.0) on MBA : not crashed

Second, I search zpty code and seek commits between 5.2 and 5.3.1.
Finally I found this commit https://github.com/zsh-users/zsh/commit/a5233fd01e9ab4953b7ff8b4cc031485b414b8e3 .

As I said, crash line is

zpty -rt $ZSH_AUTOSUGGEST_PTY_NAME suggestion '*'$'\0' 2>/dev/null

and that commit say Also fix Meta bug on pattern match in zpty -r

I experience similar problem. My zsh version is zsh 5.2 (x86_64-ubuntu-linux-gnu).
After I disable ZSH_AUTOSUGGEST_USE_ASYNC feature, it is ok, but when I enable it again, problem doesn't come anymore. So I cannot reproduce this problem. But by zsh -xv, when this problem occured, I saw message like segfault, but I didn't record it because I thought I can reproduce this problem.

Looks to be a duplicate of #281. Going to close since the issue has been fixed upstream.

Was this page helpful?
0 / 5 - 0 ratings