[Bug 1514909] [NEW] zsh compinit breaks with KSH_ARRAYS, KSH_GLOB
Mikel Ward
mikel at mikelward.com
Tue Nov 10 16:33:58 UTC 2015
Public bug reported:
After upgrading to wily, trying to Tab autocomplete prints a bunch of
errors.
It seems that
if [[ -z "$skip_global_compinit" ]]; then
autoload -U compinit
compinit
fi
in /etc/zsh/zshrc, and the completion rules it loads from
/usr/share/zsh/functions/Completion, is incompatible with KSH_ARRAYS and
KSH_GLOB, which previously worked fine in vivid.
Repro:
---
sudo useradd -m zshtest
sudo su - zshtest
cat >.zshrc <<EOF
emulate sh
setopt KSH_ARRAYS
setopt KSH_GLOB
EOF
sudo su - zshtest
cd /<TAB>
mikel-study% cd /
_all_labels:63: bad math expression: operator expected at `funcstack ...'
_description:63: bad math expression: operator expected at `comp_ignor...'
_path_files:63: bad math expression: operator expected at `pfx '
_path_files:63: bad math expression: operator expected at `prepaths '
_path_files:63: bad math expression: operator expected at `ignore '
_path_files:63: bad math expression: operator expected at `ignore'
_main_complete:338: bad math expression: operator expected at `lastdescr'
_main_complete:377: bad math expression: operator expected at `comp_color...'
---
Putting skip_global_compinit=1 in ~/.zshenv works around the problem, as
does "unsetopt GLOBAL_RCS".
I imagine my set up is unsupported, but I notice that /usr/share/zsh/functions/Completion/compinit at least makes an attempt to avoid this by doing
---
emulate -L zsh
setopt extendedglob
---
One pattern that seems likely to be problematic is the dynamic
definition of functions inside other functions, such as _next_tags
creating _all_labels inside its body, which presumably uses the current
shell options rather than the ones the completions assume are active.
$ dpkg -S /etc/zsh/zshrc /usr/share/zsh/functions/Completion/Base/_next_tags
zsh-common: /etc/zsh/zshrc
zsh-common: /usr/share/zsh/functions/Completion/Base/_next_tags
$ apt-cache show zsh-common
Package: zsh-common
Priority: optional
Section: shells
Installed-Size: 11882
Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
Original-Maintainer: Debian Zsh Maintainers <pkg-zsh-devel at lists.alioth.debian.org>
Architecture: all
Source: zsh
Version: 5.1.1-1ubuntu1
** Affects: zsh (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zsh in Ubuntu.
https://bugs.launchpad.net/bugs/1514909
Title:
zsh compinit breaks with KSH_ARRAYS, KSH_GLOB
Status in zsh package in Ubuntu:
New
Bug description:
After upgrading to wily, trying to Tab autocomplete prints a bunch of
errors.
It seems that
if [[ -z "$skip_global_compinit" ]]; then
autoload -U compinit
compinit
fi
in /etc/zsh/zshrc, and the completion rules it loads from
/usr/share/zsh/functions/Completion, is incompatible with KSH_ARRAYS
and KSH_GLOB, which previously worked fine in vivid.
Repro:
---
sudo useradd -m zshtest
sudo su - zshtest
cat >.zshrc <<EOF
emulate sh
setopt KSH_ARRAYS
setopt KSH_GLOB
EOF
sudo su - zshtest
cd /<TAB>
mikel-study% cd /
_all_labels:63: bad math expression: operator expected at `funcstack ...'
_description:63: bad math expression: operator expected at `comp_ignor...'
_path_files:63: bad math expression: operator expected at `pfx '
_path_files:63: bad math expression: operator expected at `prepaths '
_path_files:63: bad math expression: operator expected at `ignore '
_path_files:63: bad math expression: operator expected at `ignore'
_main_complete:338: bad math expression: operator expected at `lastdescr'
_main_complete:377: bad math expression: operator expected at `comp_color...'
---
Putting skip_global_compinit=1 in ~/.zshenv works around the problem,
as does "unsetopt GLOBAL_RCS".
I imagine my set up is unsupported, but I notice that /usr/share/zsh/functions/Completion/compinit at least makes an attempt to avoid this by doing
---
emulate -L zsh
setopt extendedglob
---
One pattern that seems likely to be problematic is the dynamic
definition of functions inside other functions, such as _next_tags
creating _all_labels inside its body, which presumably uses the
current shell options rather than the ones the completions assume are
active.
$ dpkg -S /etc/zsh/zshrc /usr/share/zsh/functions/Completion/Base/_next_tags
zsh-common: /etc/zsh/zshrc
zsh-common: /usr/share/zsh/functions/Completion/Base/_next_tags
$ apt-cache show zsh-common
Package: zsh-common
Priority: optional
Section: shells
Installed-Size: 11882
Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
Original-Maintainer: Debian Zsh Maintainers <pkg-zsh-devel at lists.alioth.debian.org>
Architecture: all
Source: zsh
Version: 5.1.1-1ubuntu1
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/1514909/+subscriptions
More information about the foundations-bugs
mailing list