prezto icon indicating copy to clipboard operation
prezto copied to clipboard

compinit insecure fails silently disabling all tab completion

Open ClashTheBunny opened this issue 9 years ago • 5 comments

On this line:

# Load and initialize the completion system ignoring insecure directories.
autoload -Uz compinit && compinit -i

compinit fails silently for cases where homebrew is owned by somebody other than the user. This then causes all tab completion to fail silently.

I believe that there should be some sort of error shown or direction on how to fix it. It's not very user friendly to all of a sudden lose tab completion because I've changed the group on /usr/local to be the one that my wife and I share on my computer so that we can both use homebrew.

The problem stems from a deeper problem of ZSH not allowing a list of safe groups, but prezto shouldn't fail silently like it does. Debian tried to deal with this through a local patch of ZSH because of debian policy, so there are other large users of ZSH that need this functionality, but it seems to be a won't fix: http://www.zsh.org/mla/users/2012/msg00062.html or from 10 years before that: http://www.zsh.org/mla/workers/2001/msg02404.html

A workaround for me is to run: rm ~/.zcompdump && compaudit && compinit sometime after login. I'm probably going to delete the -i from the above line in my prezto, so that it at least doesn't fail silently.

ClashTheBunny avatar Dec 16 '14 10:12 ClashTheBunny

Actually, I think an error message could be produced by doing something like:

compaudit >/dev/null 2>&1 || echo "There are problems with ownership on some files causing completion to be insecure.  Disabling until fixed.  You can check the insecure files by running 'compaudit'.  The list of files and directories each have some sort of permission problem, specifically they are writable by the group or world.  You can ignore the insecure files by running 'rm ~/.zcompdump && compinit' and confirming the the desire for an insecure system."

This would keep things secure by default, but warn people of what is wrong as well as showing them how to get around it if they know that their staff group has trusted membership.

EDIT: It should have been ||, not && after compaudit.

ClashTheBunny avatar Dec 16 '14 10:12 ClashTheBunny

My autocompletion stopped working out of nowhere this week. This solved my problem. Thanks!

bensaufley avatar Dec 09 '16 21:12 bensaufley

running rm ~/.zcompdump && compaudit && compinit didn't work for me but just filed https://github.com/zsh-users/zsh-completions/issues/480 it works after brew switch zsh 5.2 autocompletion had silently and suddenly stopped working after brew upgrade-ing all packages which had upgraded zsh to 5.3 (seems like a regression)

timotheecour avatar Dec 22 '16 10:12 timotheecour

This worked for me. From some reason the completion stopped working out of a blue. Also, when I started zsh, before getting a prompt, it listed some zsh functions.

...
url-quote-magic () {
	# undefined
	builtin autoload -XUz
}
vcs_info () {
	# undefined
	builtin autoload -XUz
}
wdiff () {
	# undefined
	builtin autoload -XUz
}
zmv () {
	# undefined
	builtin autoload -XU
}
 …/~ $

The problem was in the insecure directories. After fixing the permissions and re-running compinit all works fine.

fikovnik avatar Oct 29 '17 17:10 fikovnik

I also just had my tab completion silently stop working. It was resolved by running autoload -Uz compinit && compinit -i.

christianbundy avatar Jan 15 '19 19:01 christianbundy