Zsh crashes when opening the history search by the up arrow immediately after the globbed files and expansion completion is shown for a name that's over ($COLUMNS - 10) characters.
This issue is initially discovered during processing of url. When using expression like echo ${url%\?*} and try to access history search, zsh crashes.
Environment
% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
typeset VENDOR=ubuntu
typeset OSTYPE=linux-gnu
typeset ZSH_PATCHLEVEL=ubuntu/5.9-6ubuntu2
typeset -a _autocomplete__funcfiletrace=(
/root/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
/root/.zshrc:5
zsh:0
)
% git -C ~autocomplete log --oneline -n1
bbba73e (grafted, HEAD -> main, origin/main, origin/HEAD) Add support for tiny terminals
Steps to reproduce
% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
<output>
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
% # <input>
% rand-name () {
local len="${1:-16}"
tr -dc 'A-Za-z0-9' < /dev/urandom | head -c ${len}
} # just a function to generate random characters
% # NOTE: to reproduce the bug, globbed files and expansion must be shown. \
# This is triggered by placing the cursor in front of the last \" for the command below. \
# Press up arrow immediately after the command is executed by enter when \
# the globbed files and expansion is shown. \
# CHANGE 90 TO ($COLUMNS - 10)
% v="$(rand-name 90)"
globbed files
\=WPhS3QaaE4mOksvcq0E9gNqsWRJEW1wpNoklS7c9OSnFPQ2eR78AXunzadsnrffroH6bwr4qe9otOc2WZa1osNOcoS
expansion
\=WPhS3QaaE4mOksvcq0E9gNqsWRJEW1wpNoklS7c9OSnFPQ2eR78AXunzadsnrffroH6bwr4qe9otOc2WZa1osNOcoS
common substring:
% <up arrow>
% # <output>
free(): corrupted unsorted chunks
zsh: IOT instruction (core dumped)
Contents of ~autocomplete-log/YYYY-MM-DD.log (click to expand)
.autocomplete:async:pty:zle-widget:19: completion cannot be used recursively (yet)
.autocomplete:async:complete:fd-widget:37: completion cannot be used recursively (yet)
Zsh crashes when opening the history search by the up arrow immediately after the globbed files and expansion completion is shown for a name that's over ($COLUMNS - 10) characters.
This issue is initially discovered during processing of url. When using expression like
echo ${url%\?*}and try to access history search, zsh crashes.Environment
Operating system:
Ubuntu 24.04.1 LTS
NOTE: The issue is reproduced inside a clean docker container using image ubuntu:latest.
Terminal emulator:
Gnome Terminal
Steps to reproduce
Contents of
~autocomplete-log/YYYY-MM-DD.log(click to expand)