#27504 closed defect (fixed)
bash completion and sudo password problem
Reported by: | heapifyman@… | Owned by: | raimue (Rainer Müller) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 1.9.2 |
Keywords: | Cc: | heapifyman@… | |
Port: | bash-completion |
Description
I installed macports, updated to 1.9.2, then installed the bash completion. When I press TAB key after entering
sudo port upgrade out
I get the following output in the Terminal:
sudo port upgrade outPassword:
and the command obviously doesn't work.
Change History (15)
comment:1 Changed 14 years ago by mf2k (Frank Schima)
Cc: | heapifyman@… removed |
---|---|
Keywords: | bash completion sudo password removed |
Owner: | changed from macports-tickets@… to raimue@… |
Port: | bash-completion added |
comment:2 Changed 14 years ago by heapifyman@…
Yes, I added above snippet to my .profile file as instructed, since I did not have a .bash_profile file.
comment:3 follow-up: 4 Changed 14 years ago by raimue (Rainer Müller)
Hm, I can't reproduce this problem...
comment:4 follow-up: 6 Changed 14 years ago by heapifyman@…
Replying to raimue@…:
Hm, I can't reproduce this problem...
I should maybe add that I had
Defaults timestamp_timeout=0
set in my sudoers file.
Without this, the problem does not occur
comment:6 Changed 14 years ago by heapifyman@…
Replying to heapifyman@…:
Replying to raimue@…:
Hm, I can't reproduce this problem...
I should maybe add that I had
Defaults timestamp_timeout=0set in my sudoers file.
Without this, the problem does not occur
Ignore the above, please. This only works if the password has been entered before, obviously. But for me, if the password has not been cached before, bash completion does not work if port command takes more than one argument, e.g.: pressing Tab after
port list a
produces
port list aPassword:
while something like
port installed
works as expected.
comment:7 follow-up: 9 Changed 14 years ago by raimue (Rainer Müller)
Which version of bash do you use? I am not able to reproduce this with either /opt/local/bin/bash
or /bin/bash
. I do not see the password prompt, port names get completed as expected for me.
comment:8 Changed 14 years ago by raimue (Rainer Müller)
Component: | base → ports |
---|
comment:9 Changed 14 years ago by heapifyman@…
Replying to raimue@…:
Which version of bash do you use? I am not able to reproduce this with either
/opt/local/bin/bash
or/bin/bash
. I do not see the password prompt, port names get completed as expected for me.
Bash version is:
/bin/bash --version GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
comment:10 follow-up: 11 Changed 13 years ago by heapifyman@…
The problem seems to be that I am working as a non-admin user and have to invoke the port command with prepening sudo. As I am a lazy person I thought I'd add an alias to my ~/.profile like this:
alias port="sudo port"
The problem described above only happens when this alias is active. Without the alias bash-completion works as expected. Is there some other way to avoid typing sudo all the time when using port command?
comment:11 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to heapifyman@…:
The problem seems to be that I am working as a non-admin user and have to invoke the port command with prepening sudo.
Even admin users have to do that. Only the root user wouldn't have to do that, but nobody would log into a Mac as root.
As I am a lazy person I thought I'd add an alias to my ~/.profile like this:
alias port="sudo port"
The problem described above only happens when this alias is active. Without the alias bash-completion works as expected.
Then I would say this isn't something we need to fix.
Is there some other way to avoid typing sudo all the time when using port command?
Nope; I typo sudo
all the time too. Oh well.
comment:12 Changed 12 years ago by raimue (Rainer Müller)
Resolution: | → fixed |
---|---|
Status: | new → closed |
This was actually a problem in the way the completion was written, it should be fixed as of r95144.
comment:13 Changed 12 years ago by heapifyman@…
Thanks. It's working now after the latest update.
Only thing: I had to tell Terminal to use
/opt/local/bin/bash
instead of the default
/bin/bash
Maybe that could be added to the documentation somewhere?
comment:14 follow-up: 15 Changed 12 years ago by neverpanic (Clemens Lang)
It kind of already is in port notes bash-completion
.
comment:15 Changed 12 years ago by heapifyman@…
Replying to cal@…:
It kind of already is in
port notes bash-completion
.
Sorry, I missed that during the install. I also added that note to the bash-completion how-to page: https://trac.macports.org/wiki/howto/bash-completion
Hope that is ok.
Did you add this to your .bash_profile as instructed?