[-- Attachment #1: Type: text/plain, Size: 5939 bytes --] *Given* - A .zshrc file containing the following lines: HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history HISTSIZE=2000 SAVEHIST=1000 autoload -Uz compinit compinit zstyle ':completion:*' ignored-patterns '' - A `${ZDOTDIR:-$HOME}/.zsh_history` file that contains >1000 lines of history. *When* 1. I start a new shell with `zsh -dxv &>! ~/zsh-debug.log` 2. I press `^[/` to activate `_history-complete-older` (or anything else that uses the `_history` completer). *Then* - Zsh crashes with the message `zsh: segmentation fault`. - `~/zsh-debug.log` ends in the following lines: +_history:60> _wanted -1V history-words expl 'history word' compadd -Q -a hslice +_wanted:3> local -a __targs __gopt +_wanted:5> zparseopts -D -a __gopt 1 2 V J x 'C:=__targs' +_wanted:7> _tags history-words +_tags:3> local prev +_tags:10> [[ history-words = -- ]] +_tags:15> (( 1 )) +_tags:19> local curcontext=history-words:history:: order tag nodef tmp +_tags:21> [[ history-words = -C?* ]] +_tags:24> [[ history-words = -C ]] +_tags:29> [[ history-words = -(|-) ]] +_tags:31> zstyle -a :completion:history-words:history::: group-order order +_tags:36> comptags -i history-words:history:: history-words +_tags:40> [[ -n '' ]] +_tags:43> zstyle -a :completion:history-words:history::: tag-order order +_tags:44> (( ! 0 )) +_tags:55> [[ -z '' ]] +_tags:55> comptry history-words +_tags:60> comptags -T +_tags:62> return +_wanted:9> _tags +_tags:3> local prev +_tags:10> [[ '' = -- ]] +_tags:15> (( 0 )) +_tags:67> comptags -N +_wanted:10> _all_labels -1 -V history-words expl 'history word' compadd -Q -a hslice +_all_labels:3> local __gopt __len __tmp __pre __suf __ret=1 __descr __spec __prev +_all_labels:5> [[ -1 = - ]] +_all_labels:10> __gopt=( ) +_all_labels:11> zparseopts -D -a __gopt 1 2 V J x +_all_labels:13> __tmp=8 +_all_labels:14> __len=7 +_all_labels:15> [[ __tmp -lt __len ]] +_all_labels:18> [[ __tmp -eq 7 ]] +_all_labels:22> __pre=4 +_all_labels:23> __suf=5 +_all_labels:26> comptags -A history-words curtag __spec +_all_labels:27> (( 7 > _tags_level )) +_all_labels:27> _comp_tags='' +_all_labels:28> _tags_level=7 +_all_labels:29> _comp_tags=' history-words ' +_all_labels:30> [[ history-words = *[^\\]:* ]] +_all_labels:37> _description -1 -V history-words expl 'history word' +_description:3> local name nopt xopt format gname hidden hide match opts tag +_description:4> local -a ign gropt sort +_description:6> opts=( ) +_description:8> xopt=( -X ) +_description:9> nopt=( ) +_description:10> zparseopts -K -D -a nopt 1 2 'V=gropt' 'J=ign' 'x=xopt' +_description:12> 3='history word' +_description:13> [[ -n 'history word' ]] +_description:13> _lastdescr=( '' 'history word' ) +_description:15> zstyle -s :completion:history-words:history:::history-words group-name gname +_description:18> _setup history-words -default- +_setup:3> local val nm=0 +_setup:5> [[ 2 -eq 1 ]] +_setup:7> zstyle -a :completion:history-words:history:::history-words list-colors val +_setup:21> [[ history-words = default ]] +_setup:27> zstyle -s :completion:history-words:history:::history-words show-ambiguity val +_setup:32> zstyle -t :completion:history-words:history:::history-words list-packed +_setup:34> [[ 2 -eq 1 ]] +_setup:37> compstate[list]=ambiguous +_setup:40> zstyle -t :completion:history-words:history:::history-words list-rows-first +_setup:42> [[ 2 -eq 1 ]] +_setup:45> compstate[list]=ambiguous +_setup:48> zstyle -t :completion:history-words:history:::history-words last-prompt +_setup:50> [[ 2 -eq 1 ]] +_setup:53> compstate[last_prompt]=yes +_setup:56> zstyle -t :completion:history-words:history:::history-words accept-exact +_setup:58> [[ 2 -eq 1 ]] +_setup:61> compstate[exact]='' +_setup:64> [[ _last_nmatches -ge 0 ]] +_setup:67> zstyle -a :completion:history-words:history:::history-words menu val +_setup:71> _last_nmatches=-1 +_setup:74> [[ '' != always ]] +_setup:75> zstyle -s :completion:history-words:history:::history-words force-list val +_description:20> name=expl +_description:22> zstyle -s :completion:history-words:history:::history-words format format +_description:23> zstyle -s :completion:history-words:history:::descriptions format format +_description:25> zstyle -s :completion:history-words:history:::history-words hidden hidden +_description:30> zstyle -s :completion:history-words:history:::history-words matcher match +_description:32> [[ -n '' ]] +_description:36> [[ -z -V ]] +_description:47> gropt=( -o nosort ) +_description:50> [[ -z '' ]] +_description:51> zstyle -a :completion:history-words:history:::history-words ignored-patterns _comp_ignore +_description:54> zstyle -s :completion:history-words:history:::history-words ignore-line hidden +_description:70> (( 1 )) +_description:70> opts=( -F _comp_ignore ) +_description:75> tag=history-words +_description:77> shift 2 +_description:78> [[ -z 'history word' ]] +_description:80> [[ -n '' ]] +_description:84> [[ -n '' ]] +_description:91> [[ -n '' ]] +_description:94> set -A expl -F _comp_ignore -1 -o nosort -J -default- +_description:98> (( 0 )) +_description:99> local fakestyle descr +_description:100> fakestyle=fake +_description:101> zstyle -a :completion:history-words:history:::history-words fake match +_description:102> continue +_description:100> fakestyle=fake-always +_description:101> zstyle -a :completion:history-words:history:::history-words fake-always match +_description:102> continue +_description:115> return 0 +_all_labels:39> compadd -F _comp_ignore -1 -o nosort -J -default- -Q -a hslice *Additional notes:* If I - remove the line `zstyle ':completion:*' ignored-patterns ''` or - change it to `zstyle ':completion:*:^(history-words)' ignored-patterns ''` or - remove the histfile, then the crash no longer happens. It doesn't matter what the actual value of `ignored-patterns` is. Whenever it is used with the `_history` completer, Zsh crashes on the same line.
Marlon Richert wrote on Mon, 25 May 2020 14:02 +0300:
> *Given*
>
> - A .zshrc file containing the following lines:
>
> HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
> HISTSIZE=2000
> SAVEHIST=1000
> autoload -Uz compinit
> compinit
> zstyle ':completion:*' ignored-patterns ''
>
>
> - A `${ZDOTDIR:-$HOME}/.zsh_history` file that contains >1000 lines of
> history.
>
> *When*
>
> 1. I start a new shell with `zsh -dxv &>! ~/zsh-debug.log`
> 2. I press `^[/` to activate `_history-complete-older` (or anything else
> that uses the `_history` completer).
>
> *Then*
>
> - Zsh crashes with the message `zsh: segmentation fault`.
> - `~/zsh-debug.log` ends in the following lines:
>
I followed these steps as follows:
[[[
$ cd "$(mktemp -d)"
$ tee .zshrc
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
HISTSIZE=2000
SAVEHIST=1000
autoload -Uz compinit
compinit
zstyle ':completion:*' ignored-patterns ''
<pressed Ctrl+D>
$ yes | head -1001 > .zsh_history
$ ZDOTDIR=$PWD $builddir/Src/zsh -d
% bindkey -e
% <pressed M-/>
]]]
The terminal beeped and no crash happened.
What's your $ZSH_VERSION and $ZSH_PATCHLEVEL?
[-- Attachment #1: Type: text/plain, Size: 843 bytes --] On Tue, 26 May 2020 at 21:48, Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > I followed these steps as follows: > > [[[ > $ cd "$(mktemp -d)" > $ tee .zshrc > HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history > HISTSIZE=2000 > SAVEHIST=1000 > autoload -Uz compinit > compinit > zstyle ':completion:*' ignored-patterns '' > <pressed Ctrl+D> > $ yes | head -1001 > .zsh_history > $ ZDOTDIR=$PWD $builddir/Src/zsh -d > % bindkey -e > % <pressed M-/> > ]]] > > The terminal beeped and no crash happened. > > What's your $ZSH_VERSION and $ZSH_PATCHLEVEL? > $ZSH_VERSION = 5.8 $ZSH_PATCHLEVEL = zsh-5.8-0-g77d203f Could the contents of my histfile have an influence on this? If you do `yes | head -1001 > .zsh_history`, then there is no realistic data in the histfile. I noticed that if I start Zsh without a histfile, then the problem does not occur.
Marlon Richert wrote on Thu, 28 May 2020 10:49 +0300: > On Tue, 26 May 2020 at 21:48, Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > > > > I followed these steps as follows: > > > > [[[ > > $ cd "$(mktemp -d)" > > $ tee .zshrc > > HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history > > HISTSIZE=2000 > > SAVEHIST=1000 > > autoload -Uz compinit > > compinit > > zstyle ':completion:*' ignored-patterns '' > > <pressed Ctrl+D> > > $ yes | head -1001 > .zsh_history > > $ ZDOTDIR=$PWD $builddir/Src/zsh -d > > % bindkey -e > > % <pressed M-/> > > ]]] > > > > The terminal beeped and no crash happened. > > > > What's your $ZSH_VERSION and $ZSH_PATCHLEVEL? > > > > $ZSH_VERSION = 5.8 > $ZSH_PATCHLEVEL = zsh-5.8-0-g77d203f > > Could the contents of my histfile have an influence on this? If you do `yes > | head -1001 > .zsh_history`, then there is no realistic data in the > histfile. > That's possible, yes. Can _you_ reproduce the bug using the steps I posted? I don't have your $HISTFILE, but I can't reproduce the issue if I substitute my $HISTFILE (using «cp $HISTFILE ./.zsh_history») into the above steps, and it's longer than 1000 lines. > I noticed that if I start Zsh without a histfile, then the problem does not > occur. What if you start zsh with a empty histfile? If you can reproduce the problem with your usual histfile but not with an empty one, try reducing your histfile to the smallest one that does still reproduce the problem. There are generic instructions at http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=45791, if you aren't familiar with the procedure. (They're written for .zshrc but you can apply them to $HISTFILE as well.) Can you try reproducing the bug in zsh built from master? Cheers, Daniel
[-- Attachment #1: Type: text/plain, Size: 1266 bytes --] On Thu, 28 May 2020 at 11:44, Daniel Shahaf <d.s@daniel.shahaf.name> wrote: > > Could the contents of my histfile have an influence on this? If you do > `yes > > | head -1001 > .zsh_history`, then there is no realistic data in the > > histfile. > > > > That's possible, yes. Can _you_ reproduce the bug using the steps I > posted? > > I don't have your $HISTFILE, but I can't reproduce the issue if > I substitute my $HISTFILE (using «cp $HISTFILE ./.zsh_history») into the > above steps, and it's longer than 1000 lines. > > > I noticed that if I start Zsh without a histfile, then the problem does > not > > occur. > > What if you start zsh with a empty histfile? > > If you can reproduce the problem with your usual histfile but not with > an empty one, try reducing your histfile to the smallest one that does > still reproduce the problem. There are generic instructions at > http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=45791, if you > aren't familiar with the procedure. (They're written for .zshrc but > you can apply them to $HISTFILE as well.) > > Can you try reproducing the bug in zsh built from master? > I am no longer able to reproduce it in any kind of way. Sorry. But at least the problem is gone. :)
Marlon Richert wrote on Fri, 05 Jun 2020 00:31 +0300:
> On Thu, 28 May 2020 at 11:44, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> > > Could the contents of my histfile have an influence on this? If you do
> > `yes
> > > | head -1001 > .zsh_history`, then there is no realistic data in the
> > > histfile.
> > >
> >
> > That's possible, yes. Can _you_ reproduce the bug using the steps I
> > posted?
> >
> > I don't have your $HISTFILE, but I can't reproduce the issue if
> > I substitute my $HISTFILE (using «cp $HISTFILE ./.zsh_history») into the
> > above steps, and it's longer than 1000 lines.
> >
> > > I noticed that if I start Zsh without a histfile, then the problem does
> > not
> > > occur.
> >
> > What if you start zsh with a empty histfile?
> >
> > If you can reproduce the problem with your usual histfile but not with
> > an empty one, try reducing your histfile to the smallest one that does
> > still reproduce the problem. There are generic instructions at
> > http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=45791, if you
> > aren't familiar with the procedure. (They're written for .zshrc but
> > you can apply them to $HISTFILE as well.)
> >
> > Can you try reproducing the bug in zsh built from master?
> >
>
> I am no longer able to reproduce it in any kind of way. Sorry. But at least
> the problem is gone. :)
Well, I'm sure it will come back. When it does, let us know ☺
Cheers,
Daniel