You are not logged in.

#1 2015-01-05 19:38:34

klenamenis
Member
Registered: 2014-07-03
Posts: 101

[SOLVED] weird permission problem with zsh and autocompletion

Hey there,

today I noticed that everytime using TAB to autocomplete the command in my shell using zsh, it asks for root rights. If I cancel it with CTRL+C, the command gets autocompleted and I can run, type more, etc. Does anyone have an idea how this happened? bash works well, it's only zsh. I've double-checked my .zshrc but couldnt find any problems.

This is the output I get if I type "mousep [TAB] [CTRL]+[C] test"

[klemens@arch-pc ~]$ mousep[sudo] password for klemens: 
mousepad test

Hitting ENTER opens mousepad with a (new) file called test obviously.

This is my .zshrc, I already uncommented all my aliases and source lines to make sure they're not producing this behaviour, no luck. I didn't change anything from zsh's default config inside this file or anywhere else.

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory notify autocd
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '$HOME/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

#setopt completealiases

# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key

key[Home]=${terminfo[khome]}

key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}

# setup key accordingly
[[ -n "${key[Home]}"     ]]  && bindkey  "${key[Home]}"     beginning-of-line
[[ -n "${key[End]}"      ]]  && bindkey  "${key[End]}"      end-of-line
[[ -n "${key[Insert]}"   ]]  && bindkey  "${key[Insert]}"   overwrite-mode
[[ -n "${key[Delete]}"   ]]  && bindkey  "${key[Delete]}"   delete-char
[[ -n "${key[Up]}"       ]]  && bindkey  "${key[Up]}"       up-line-or-history
[[ -n "${key[Down]}"     ]]  && bindkey  "${key[Down]}"     down-line-or-history
[[ -n "${key[Left]}"     ]]  && bindkey  "${key[Left]}"     backward-char
[[ -n "${key[Right]}"    ]]  && bindkey  "${key[Right]}"    forward-char
[[ -n "${key[PageUp]}"   ]]  && bindkey  "${key[PageUp]}"   beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]]  && bindkey  "${key[PageDown]}" end-of-buffer-or-history

# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
    function zle-line-init () {
        printf '%s' "${terminfo[smkx]}"
    }
    function zle-line-finish () {
        printf '%s' "${terminfo[rmkx]}"
    }
    zle -N zle-line-init
    zle -N zle-line-finish
fi

## set personal prompt look
autoload -U promptinit
promptinit
prompt redhat

## copy a file's content to the clipboard
c2cb() {
	cat $1 | xsel -i -b
}

# fix steam runtime issues
alias steam-fix='find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete'

alias bt='systemd-analyze'

alias sn='sudo nano'
alias gm='gksu mousepad'

alias status='systemctl status'
alias start='sudo systemctl start'
alias stop='sudo systemctl stop'
alias restart='sudo systemctl restart'
alias reload='sudo systemctl reload'
alias enable='sudo systemctl enable'
alias disable='sudo systemctl disable'

# reboot into windows
alias r2w='sudo grub-reboot 5 && cinnamon-session-quit --power-off'

# get some colors in ls
alias ls='ls --color=auto'

## FISH like syntax highlightning
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

export EDITOR=nano

## source various custom pacman alias'
source /home/klemens/.pacrc

Last edited by klenamenis (2015-01-31 08:03:06)

Offline

#2 2015-01-06 02:51:22

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: [SOLVED] weird permission problem with zsh and autocompletion

Do all the aliases work as expected?
Do your key bindings work as expected? (except for the Tab tongue )
can you share the contents of that .pacrc file?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2015-01-06 16:05:35

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Yes, they both do. As stated, I commented the .pacrc line out, but here's the content:

# Pacman alias examples
alias pud='pacaur -Sy'		# Update and refresh the local package databases against repositories
alias pug='pacaur -Su'		# Synchronize with repositories and then upgrade packages that are out of date on the local system.

alias pdl='pacaur -Sw'		# Download specified package(s) as .tar.xz ball

alias pi='pacaur -S'		# Install specific package(s) from the repositories
alias pins='pacaur -U'		# Install specific package not from the repositories but from a file 
alias pinsd='pacaur -S --asdeps' # Install given package(s) as dependencies

alias pr='pacaur -R'		# Remove the specified package(s), retaining its configuration(s) and required dependencies
alias prd='sudo pacaur -Rns'	# Remove the specified package(s), its configuration(s) and unneeded dependencies
alias prem='pacaur -Rdd'	# Remove the specified package(s), disregarding dependencies

alias po="pacaur -Qdt"		# List all packages which are orphaned
alias por="sudo pacaur -Rns $(pacaur -Qtdq)"
				# recursively remove ALL orphaned packages

alias ps='pacaur -Ss'		# Search for package(s) in the repositories
alias psl='pacaur -Qs'		# Search for package(s) in the local database

alias pii='pacaur -Sii'		# Display information about a given package in the repositories
alias piil='pacaur -Qi'		# Display information about a given package in the local database

alias plf="pacaur -Ql"		# List all files installed by a given package

alias pfo="pacaur -Qo"		# Show package(s) owning the specified file(s)

alias pexpl="pacaur -D --asexp"		# Mark one or more installed packages as explicitly installed 
alias pimpl="pacaur -D --asdep"		# Mark one or more installed packages as non explicitly installed


##
## dealing with the following message from pacman:
## 
##     error: couldnt lock database: file exists
##     if you are sure a package manager is not already running, you can remove /var/lib/pacman/db.lck

alias pacunlock="sudo rm /var/lib/pacman/db.lck"	# Delete the lock file /var/lib/pacman/db.lck
alias paclock="sudo touch /var/lib/pacman/db.lck"	# Create the lock file /var/lib/pacman/db.lck

Offline

#4 2015-01-06 16:10:21

Spyhawk
Member
Registered: 2006-07-07
Posts: 485

Re: [SOLVED] weird permission problem with zsh and autocompletion

Probably not related to your issue, but don't use "sudo" in front of pacaur commands - it has never been designed to work this way. Rather, it calls sudo internally.
The last version (released a few hours ago) exits if sudo is misused this way.

Last edited by Spyhawk (2015-01-06 16:12:27)

Offline

#5 2015-01-06 16:40:51

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Spyhawk wrote:

Probably not related to your issue, but don't use "sudo" in front of pacaur commands - it has never been designed to work this way. Rather, it calls sudo internally.
The last version (released a few hours ago) exits if sudo is misused this way.

The "prd" one should be without sudo, I missed that, thanks. "por" however won't work without sudo.

Edit: I just updated pacaur to 4.2.16-1 and "prd" still works fine with sudo.

Edit: any help?

Last edited by klenamenis (2015-01-10 01:09:33)

Offline

#6 2015-01-10 15:06:55

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Can anyone help?

Offline

#7 2015-01-10 15:31:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: [SOLVED] weird permission problem with zsh and autocompletion

Maybe we are looking in the wrong place.   Could you post your /etc/sudoers and any files in /etc/sudoers.d ?
Also <moderator mode> please don't bump -- if you want to reanimate a thread, it is better to try to provide more information </moderator mode>


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#8 2015-01-10 15:54:17

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Files in /etc/sudoers.d don't exist.

[klemens@arch-pc ~]$ sudo grep -v # /etc/sudoers | uniq

Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "ftp_proxy"

root ALL=(ALL) ALL

%wheel ALL=(ALL) ALL

Defaults env_keep += "HOME"

Defaults env_keep += "http_proxy https_proxy ftp_proxy no_proxy"

klemens	ALL = NOPASSWD: /usr/sbin/pm-suspend

This looks clear to me, so far. I don't know what further information to provide, but I keep your advise in mind smile

Offline

#9 2015-01-10 16:46:50

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] weird permission problem with zsh and autocompletion

This may not be of any use at all, but have you tried starting your term window from a term window?  I'm not sure if that would provide any more information about what's going on with tab or not when you try to recreate this issue.


Knute

Offline

#10 2015-01-10 16:57:55

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Knute wrote:

This may not be of any use at all, but have you tried starting your term window from a term window?  I'm not sure if that would provide any more information about what's going on with tab or not when you try to recreate this issue.

If you mean running xfce4-terminal inside the terminal I started using a hot key and then press [TAB] in this newly created terminal: No, same behaviour.

Offline

#11 2015-01-10 21:37:41

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] weird permission problem with zsh and autocompletion

What does your journalctl say?  (journalctl | grep sudo)


Knute

Offline

#12 2015-01-11 20:10:36

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Knute wrote:

What does your journalctl say?  (journalctl | grep sudo)

After a fresh reboot and using the "mousep [TAB] [CTRL]+[C]" example from above:

[klemens@arch-pc ~]$ mousep[sudo] password for klemens: 
mousepad 
[klemens@arch-pc ~]$ journalctl --since "1 min ago" | grep sudo
Jan 11 21:08:39 arch-pc sudo[4117]: pam_unix(sudo:auth): conversation failed
Jan 11 21:08:39 arch-pc sudo[4117]: pam_unix(sudo:auth): auth could not identify password for [klemens]

Last edited by klenamenis (2015-01-11 20:18:47)

Offline

#13 2015-01-31 08:02:36

klenamenis
Member
Registered: 2014-07-03
Posts: 101

Re: [SOLVED] weird permission problem with zsh and autocompletion

Ok, after this issue drove me nuts I double checked all my settings and custom lines in the .zshrc file again, only to find out that it's the line

compinit

which results in this weird behaviour. This was set bei zsh's compinstall, I can't tell when or why exactly this happened, but it's finally fixed (at least for me now).

Offline

Board footer

Powered by FluxBB