[Bug 2020392] [NEW] Default path for sudo TAB completion

wentuq 2020392 at bugs.launchpad.net
Mon May 22 22:29:20 UTC 2023


Public bug reported:

I had a problem when I added custom path to my $PATH. I did, `export PATH="$HOME/bin:$PATH`, and added a secure_path in visudo. when I was using TAB completion, I neved could get TAB-completion for sudo <files in ~/bin>. Problem never existed in bash, there autocompletions works for $HOME/bin whenever its added to $PATH.
I discover that, it's because at least zsh-common_5.9-1_all/zsh-common_5.9-4_all/zsh-common_5.8.1-1_all

adds in /etc/zsh/zshrc
```
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
                                           /usr/local/bin  \
                                           /usr/sbin       \
                                           /usr/bin        \
                                           /sbin           \
                                           /bin            \
                                           zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
                                           /usr/local/bin  \
                                           /usr/sbin       \
                                           /usr/bin        \
                                           /sbin           \
                                           /bin            \
                                           /usr/X11R6/bin

```
and overwrites the zsh defaults.
I think those lines should be removed completely, because the defaults are more sane and are consistent with bash. When removed mentioned zstyle, did `export PATH=$HOME/bin:$PATH` and did sudo<TAB>. It was working as expected.
I was just trying to append to my `$HOME/bin` to specified defaults but it can't be done, you have to overwrite those zstyle.

Beside it all, it was just quite hard, to know what is going on, and
what is overwriting really sane and working defaults.

** Affects: zsh (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  I had a problem when I added custom path to my $PATH. I did, `export PATH="$HOME/bin:$PATH`, and added a secure_path in visudo. when I was using TAB completion, I neved could get TAB-completion for sudo <files in ~/bin>. Problem never existed in bash, there autocompletions works for $HOME/bin whenever its added to $PATH.
  I discover that, it's because at least zsh-common_5.9-1_all/zsh-common_5.9-4_all/zsh-common_5.8.1-1_all
  
  adds in /etc/zsh/zshrc
  ```
  zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
-                                            /usr/local/bin  \
-                                            /usr/sbin       \
-                                            /usr/bin        \
-                                            /sbin           \
-                                            /bin            \
-                                            zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
-                                            /usr/local/bin  \
-                                            /usr/sbin       \
-                                            /usr/bin        \
-                                            /sbin           \
-                                            /bin            \
-                                            /usr/X11R6/bin
+                                            /usr/local/bin  \
+                                            /usr/sbin       \
+                                            /usr/bin        \
+                                            /sbin           \
+                                            /bin            \
+                                            zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
+                                            /usr/local/bin  \
+                                            /usr/sbin       \
+                                            /usr/bin        \
+                                            /sbin           \
+                                            /bin            \
+                                            /usr/X11R6/bin
  
  ```
  and overwrites the zsh defaults.
  I think those lines should be removed completely, because the defaults are more sane and are consistent with bash. When removed mentioned zstyle, did `export PATH=$HOME/bin:$PATH` and did sudo<TAB>. It was working as expected.
  I was just trying to append to my `$HOME/bin` to specified defaults but it can't be done, you have to overwrite those zstyle.
  
- Beside it all, it was just quite hard, to know what is going, and what
- is overwriting really sane and working defaults.
+ Beside it all, it was just quite hard, to know what is going on, and
+ what is overwriting really sane and working defaults.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zsh in Ubuntu.
https://bugs.launchpad.net/bugs/2020392

Title:
  Default path for sudo TAB completion

Status in zsh package in Ubuntu:
  New

Bug description:
  I had a problem when I added custom path to my $PATH. I did, `export PATH="$HOME/bin:$PATH`, and added a secure_path in visudo. when I was using TAB completion, I neved could get TAB-completion for sudo <files in ~/bin>. Problem never existed in bash, there autocompletions works for $HOME/bin whenever its added to $PATH.
  I discover that, it's because at least zsh-common_5.9-1_all/zsh-common_5.9-4_all/zsh-common_5.8.1-1_all

  adds in /etc/zsh/zshrc
  ```
  zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
                                             /usr/local/bin  \
                                             /usr/sbin       \
                                             /usr/bin        \
                                             /sbin           \
                                             /bin            \
                                             zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
                                             /usr/local/bin  \
                                             /usr/sbin       \
                                             /usr/bin        \
                                             /sbin           \
                                             /bin            \
                                             /usr/X11R6/bin

  ```
  and overwrites the zsh defaults.
  I think those lines should be removed completely, because the defaults are more sane and are consistent with bash. When removed mentioned zstyle, did `export PATH=$HOME/bin:$PATH` and did sudo<TAB>. It was working as expected.
  I was just trying to append to my `$HOME/bin` to specified defaults but it can't be done, you have to overwrite those zstyle.

  Beside it all, it was just quite hard, to know what is going on, and
  what is overwriting really sane and working defaults.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/2020392/+subscriptions




More information about the foundations-bugs mailing list