Bug 2055162 - Autocompletion broken in zsh-5.8.1
Summary: Autocompletion broken in zsh-5.8.1
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: zsh
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-16 11:42 UTC by Sergio Losilla
Modified: 2022-02-21 07:45 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-21 07:45:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Sergio Losilla 2022-02-16 11:42:30 UTC
Description of problem:

When using autocomplete,

$ git checkout [TAB]
(eval):1: _git: function definition file not found
_main_complete:208: _ignored: function definition file not found
_main_complete:208: _approximate: function definition file not found

Version-Release number of selected component (if applicable):

5.8.1

How reproducible:

Always.

Steps to Reproduce:
1. Update zsh to 5.8.1
2. On a console, type a command (eg ls or git) and press tab.

Actual results:

An error is shown.

Expected results:

Arguments are autocompleted or suggested.

Additional info:

Opening zsh shows and error that compinit cannot be loaded.

FPATH does not include /usr/lib64/zsh/5.8.1/functions. Adding it manually still gives an error when attempting to autocomplete:

$ ls /
_arguments:325: failed to load module `zsh/computil': /usr/lib64/zsh/5.8/zsh/computil.so: cannot open shared object file: No such file or directory

Comment 1 Jason Tibbitts 2022-02-16 18:58:06 UTC
Are you sure you restarted zsh after the update?  Even typing "exec zsh" is sufficient.  This has always been necessary every time zsh updates to a new version.

I just updated a machine and I get the same behavior on a running shell but not on a new shell or after running "exec zsh".

Comment 2 Sergio Losilla 2022-02-16 19:03:08 UTC
Yes, I tried. I just tested again, and this is what I get:

$ exec zsh
/home/sergio/.zshrc:20: compinit: function definition file not found

Comment 3 Pierre-YvesChibon 2022-02-17 10:22:22 UTC
This is what I get here:

$ exec zsh
/home/pingou/.zshrc:11: compinit: function definition file not found
/home/pingou/.zshrc:12: promptinit: function definition file not found
/home/pingou/.zshrc:13: bashcompinit: function definition file not found
precmd:8: vcs_info: function definition file not found

Comment 4 daniel g. siegel 2022-02-18 12:32:04 UTC
The problem seems to be a wrong path in $fpath:

echo $fpath
/usr/share/Modules/init/zsh-functions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.8/functions

The directory "/usr/share/zsh/5.8/functions" does not exist anymore since the upgrade, the correct directory would have to be "/usr/share/zsh/5.8.1/functions".

It can be temporarily fixed by putting the following into your .zshrc

fpath=($fpath /usr/share/zsh/5.8.1/functions)

Comment 5 daniel g. siegel 2022-02-18 12:48:46 UTC
Looking at the spec file, it seems that the installation process is correct: https://src.fedoraproject.org/rpms/zsh/blob/rawhide/f/zsh.spec#_105

So it seems to be an issue of how ZSH_VERSION gets compiled into fpath.

Comment 6 Kamil Dudka 2022-02-19 15:52:38 UTC
I guess this was caused by updating the zsh package from 5.8 to 5.8.1 while zsh was running.  The following command (or opening a new session) should fix it:

$ exec zsh -l

We normally do not rebase zsh in stable releases of Fedora, so troubles like this do not happen.  This time I preferred a rebase over backport to make it more obvious that Fedora is no longer affected by CVE-2021-45444.

Sorry for the inconveniences!

Comment 7 Pierre-YvesChibon 2022-02-20 20:28:57 UTC
Doesn't work for me:

$ exec zsh -l
/home/pingou/zshrc:11: compinit: function definition file not found
/home/pingou/.zshrc:12: promptinit: function definition file not found
/home/pingou/.zshrc:13: bashcompinit: function definition file not found
precmd:8: vcs_info: function definition file not found  


I does work if I add the work around Daniel mentioned in comment #4.

Comment 8 daniel g. siegel 2022-02-20 20:45:12 UTC
I guess you would have to restart your session like Kamil said (comment #6). If that doesn't work, try to reboot to make sure your entire session was restarted.

It does work here after restarting my session (and making sure no lingering processes like e.g. gnome-terminal-server are still around):

$ echo $fpath
/usr/share/Modules/init/zsh-functions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.8.1/functions

Comment 9 Sergio Losilla 2022-02-20 21:15:16 UTC
Confirmed that restarting fixes the issue for me.

Comment 10 Kamil Dudka 2022-02-21 07:45:22 UTC
(In reply to Pierre-YvesChibon from comment #7)
> Doesn't work for me:
> 
> $ exec zsh -l
> /home/pingou/zshrc:11: compinit: function definition file not found
> /home/pingou/.zshrc:12: promptinit: function definition file not found
> /home/pingou/.zshrc:13: bashcompinit: function definition file not found
> precmd:8: vcs_info: function definition file not found  
> 
> 
> I does work if I add the work around Daniel mentioned in comment #4.

For some reason $fpath is not updated while executing the new version of zsh.  I am not able to reproduce it locally, so I have no idea how to fix it.

Next time I will rather pick the security fix without changing zsh version in stable releases of Fedora.  Sorry for the troubles!


Note You need to log in before you can comment on or make changes to this bug.