[Pkg-zsh-devel] Bug#663982: zsh: autocompletion does not work anymore after compinit

Martin Steigerwald ms at teamix.de
Mon Mar 26 07:51:56 UTC 2012


Am Donnerstag, 22. März 2012 schrieb Frank Terbeck:
> Martin Steigerwald wrote:
> > auto completion stopped worked since this week. This might be related
> > to an upgrade of Z-Shell. It is related configuration, with an empty
> > .zshrc it works. But with the recommended configuration from the
> > system administrator it does not.
> > 
> > I found it to stop working after compinit. With empty configuration:
> > 
> > mango% cd Infrastruktur/ [aborted with Ctrl-C]
> > mango% autoload -Uz compinit
> > mango% cd Infrastruktur/ [aborted with Ctrl-C]
> 
> Before you're running `compinit', the function-based completion system
> is *NOT* online yet. Zsh will fall back to the older compctl system.
> 
> > mango% compinit
> > mango% cd In
> > 
> > No reaction on tab anymore.
> 
> When you say "no reaction" do you mean that zsh eats up all CPU or does
> it actually hang without and CPU utilisation at all?

I see no / or not much CPU utilisation. When I enter

cd Intr

and then press tab, I get the following strace:

ms at mango:~> strace -fF -p 8220
Process 8220 attached - interrupt to quit
read(10, "\t", 1)                       = 1
fcntl64(0, F_DUPFD, 10)                 = 11
close(0)                                = 0
mmap2(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb73d7000
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
mmap2(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb73d3000
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
open("/dev/null", O_RDONLY|O_NOCTTY|O_LARGEFILE) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
[… lots more of these …]
munmap(0xb73d3000, 16384)               = 0
munmap(0xb73d7000, 16384)               = 0
dup2(11, 0)                             = 0
close(11)                               = 0
write(10, "\7", 1)                      = 1
read(10, ^C <unfinished ...>
Process 8220 detached

File descriptors are as follows:

ms at mango:/proc/8220> ls -l fd
insgesamt 0
lrwx------ 1 ms teamix 64 Mär 26 09:37 0 -> /dev/pts/13
lrwx------ 1 ms teamix 64 Mär 26 09:41 1 -> /dev/pts/13
lrwx------ 1 ms teamix 64 Mär 26 09:41 10 -> /dev/pts/13
lrwx------ 1 ms teamix 64 Mär 26 09:41 2 -> /dev/pts/13
ms at mango:/proc/8220> 

That mmap2 seems to be related to the completion shared object:

ms at mango:/proc/8220> pmap -d 8220 | head -2 ; pmap -d 8220 | grep b73d
8220:   /usr/bin/zsh
Address   Kbytes Mode  Offset           Device    Mapping
b73db000     132 r-x-- 0000000000000000 009:00001 complete.so


So basically Z-Shell seems to be doing nothing it seems to me.

> > But this only happens for *one* user that uses a home directory on NFS.
> 
> If NFS is in play it could also be bad performance with certain options.
> Does the shell hang or does completion just take a very very long time?
> As in "minutes"?

It just does not seem to occur at all. The Konsole tab with the zsh process 
8220 is still sitting at "cd Infr" as if I didn't hit the tab key at all.

> > Neither with root nor with a local user I can reproduce this.
> > 
> > Tab completion worked for the NFS user as well before. I can fix it by
> > uncommenting compinit from his .zshrc.
> 
> Sounds weird. Can't identify a reason off hand.

Welcome to the club ;).

> > This is the .zshrc of the user, but as said it also does not work
> > with the system admin recommended one.
> 
> [...]
> 
> There is nothing in there, that would cause that I think. The other
> files (zshenv, zprofile, zlogin - global and user-only) are empty, I
> presume?

Yes, empty besides comments or not existing excdept for some path setting:

ms at mango:~> find -maxdepth 1 -name ".zsh*"
./.zshrc-empty
./.zshrc-off
./.zshrc
./.zshrc-sysadm
./.zsh_history

mango:~# cat /etc/zsh/zshenv
# /etc/zsh/zshenv: system-wide .zshenv file for zsh(1).
[… comments …]

if [[ -z "$PATH" || "$PATH" == "/bin:/usr/bin" ]]
then
        export PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

mango:~# grep -v "^#" /etc/zsh/zlogin
mango:~# grep -v "^#" /etc/zsh/zprofile 
mango:~#

I didn't touch any of these AFAIR.

> > Even with this configuration auto completion does not work for the
> > autocd case. But for the local test user it works also in the autocd
> > case. For the local test user it also works when I navigate on the
> > NFS export.
> 
> My *guess* is that something triggers user-name lookups which may take a
> very long time with a lot of users in networked environments. But like I
> said, it's a guess for now...

Well, I didn't have this issue before. Username lookups are with LDAP via 
libnss-ldapd which should do some caching.

Ciao,
-- 
Martin Steigerwald - teamix GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90





More information about the Pkg-zsh-devel mailing list