Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Zsh crashes on `compadd` when using `_history` completer & zstyle `ignored-patterns` is set
- X-seq: zsh-workers 45911
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Zsh crashes on `compadd` when using `_history` completer & zstyle `ignored-patterns` is set
- Date: Mon, 25 May 2020 14:02:27 +0300
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
*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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author