Gentoo Archives: gentoo-user

From: Nikos Chantziaras <realnc@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: bash completion doesn't always work with sudo
Date: Sun, 06 Apr 2014 17:16:55
Message-Id: lhs25b$htq$1@ger.gmane.org
In Reply to: Re: [gentoo-user] bash completion doesn't always work with sudo by staticsafe
1 On 06/04/14 18:58, staticsafe wrote:
2 > On 4/6/2014 06:44, Nikos Chantziaras wrote:
3 >> I have a problem where commands preceded by "sudo" are not always
4 >> auto-completed. This happens with executables that don't have user
5 >> execute permission. For example, net-analyzer/tcptraceroute installs
6 >> this binary:
7 >>
8 >> -rws--x--- 1 root wheel 35536 Mar 8 23:32 /usr/sbin/tcptraceroute
9 >>
10 >> Typing:
11 >>
12 >> sudo tcptr[TAB]
13 >>
14 >> does not auto-complete. Changing the permissions:
15 >>
16 >> chmod a+x /usr/sbin/tcptraceroute
17 >>
18 >> makes it work.
19 >>
20 >> Is there a way to make bash-completion work without having to modify the
21 >> permissions?
22 >>
23 >>
24 >
25 > According to https://bbs.archlinux.org/viewtopic.php?id=45613:
26 > adding `complete -cf sudo` to your .bashrc will make tab completion work
27 > with sudo.
28 >
29 > Just tested:
30 > dresden ~ # complete -cf sudo
31 > dresden ~ # sudo tcp
32 > tcpd tcpdchk tcpdmatch tcpdump tcptraceroute
33 > dresden ~ # ls -alh /usr/sbin/tcptraceroute
34 > -rws--x--- 1 root wheel 35K Apr 6 15:54 /usr/sbin/tcptraceroute
35
36 That actually breaks completion even more. Now none of the binaries in
37 /sbin and /usr/sbin are working.