Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh sometimes freezes when completing a command



On Tue, 16 Mar 2010, Vincent Lefevre wrote:

> On 2010-03-15 18:54:15 -0700, Bart Schaefer wrote:
> > On Mar 16,  1:13am, Vincent Lefevre wrote:
> > } tags in context :completion::complete:-command-::
> > } 
> > } I wonder why zsh tries to complete on users.
> > 
> > Targets for autocd, I suspect.
> 
> Yes. But can't these targets be disabled for completion, or used only 
> if the other completions failed?

From a similar discussion w/ subject: 'Avoid LDAP hit during 
completion'[1], Peter's suggestion lead me tangentially to this section, 
from somewhere in zshall (zstyle(?) .. Standard styles):

users  This may be set to a list of usernames to be completed.   If  it
	   is  not set all usernames will be completed.  Note that if it is 
	   set only that list of users will be completed; this  is  because 
	   on some systems querying all users can take a prohibitive amount 
	   of time.

E.g.: The following sets '~user' expansion to only use 'bhaskell' and 
'dovecot' (random selection from my system):

zstyle ':completion:*' users {bhaskell,dovecot}

(OT: also surprised me to realize I have 30 'named directories' at this 
point... ls ~<TAB> shows 32 items.)

As pws explained in much more detail in that thread, that might not be 
the only place users would be generated.  But, things also may have been 
cleaned up since 2005.

And, you might also be better served changing this at a different level.  
(Zsh isn't the only thing that can trigger a listing of usernames.)  My 
work computer is a Linux machine joined to a Windows Domain, and ls 
~<Tab> didn't trigger any slowness.  My Samba configuration there 
(/etc/samba/smb.conf) has the following settings:

winbind enum users = No
winbind enum groups = No
winbind separator = .

getent passwd doesn't return the DOMAIN.username entries (due to the 
'No' enum), but they're still perfectly usable as normal(-ish) system 
users.  (I can log in as DOMAIN.bhaskell via SSH, for example.)

Changing those lines got me back to slowness.  (But even 280 domain 
users doesn't take terribly long to enumerate there.)

-- 
Best,
Ben

[1] http://www.zsh.org/mla/users/2005/msg00659.html



Messages sorted by: Reverse Date, Date, Thread, Author