Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#58360 - [grml-zsh-config] sudo error with aliases defined using the "command" shell builtin

Attached to Project: Arch Linux
Opened by Bastien Traverse (Neitsab) - Thursday, 26 April 2018, 17:32 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 26 April 2018, 18:48 GMT
Task Type Bug Report
Category Upstream Bugs
Status Assigned
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



When using an alias defined in /etc/zsh/zshrc using the builtin 'command' via sudo (e.g. ll), we receive an error message "sudo: ll: command not found". However once in a root shell via sudo -i the aliases work properly.

Additional info:
* package version(s): 0.14.3-1 + zsh 5.5.1
* config and/or log files etc.
Vanilla config files, no ~/.zshrc in my user's or root's home directory and sudoers only contain "mysuer ALL=(ALL) ALL".

Affected aliases:

% grep "=\"command " /etc/zsh/zshrc
alias ls="command ls ${ls_options:+${ls_options[*]}}"
alias la="command ls -la ${ls_options:+${ls_options[*]}}"
alias ll="command ls -l ${ls_options:+${ls_options[*]}}"
alias lh="command ls -hAl ${ls_options:+${ls_options[*]}}"
alias l="command ls -l ${ls_options:+${ls_options[*]}}"
alias dir="command ls -lSrah"
alias lsbig="command ls -flh *(.OL[1,10])"
alias lsnew="command ls -rtlh *([1,10])"
alias lsold="command ls -rtlh *(D.Om[1,10])"
alias lssmall="command ls -Srl *(.oL[1,10])"
alias lsnewdir="command ls -rthdl *(/om[1,10]) .*(D/om[1,10])"
alias lsolddir="command ls -rthdl *(/Om[1,10]) .*(D/Om[1,10])"

Steps to reproduce:

$ sudo pacman -S zsh grml-zsh-config
$ chsh -s /usr/bin/zsh
$ sudo chsh -s /usr/bin/zsh root
$ zsh
% ll
<correct output>
% sudo ll
sudo: ll: command not found
% sudo -i
# ll
<correct output>
This task depends upon

Comment by Bastien Traverse (Neitsab) - Thursday, 26 April 2018, 17:39 GMT
The bug is fixed when we remove the "command" builtin in the aliases definition:

# sed -i 's/\"command/\"/g' /etc/zsh/zshrc
# source !$
% source /etc/zsh/zshrc
% sudo lh
<correct output>
Comment by Eli Schwartz (eschwartz) - Thursday, 26 April 2018, 18:48 GMT
  • Field changed: Status (Unconfirmed → Assigned)
  • Field changed: Category (Packages: Extra → Upstream Bugs)
  • Task assigned to Pierre Schmitz (Pierre)
You should ask the grml people to find a solution for their zshrc, not really sure what you expect us to do.
Comment by Bastien Traverse (Neitsab) - Friday, 04 May 2018, 12:58 GMT
I thought this was a distribution-specific problem, not packaging or setting up the command built-in "properly" (haven't got a lot of knowledge on this topic obviously). It's also part of my bug triaging process to first log it within the distro for reference (might help other users etc.), and then escalate it upstream if relevant.
So I was expecting you to assess whether it was indeed a bug and point to what to do with it, which you did. Now I'll carry it upstream and report back when I'll have news.
Comment by Bastien Traverse (Neitsab) - Friday, 04 May 2018, 14:05 GMT