Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 98627 - bash-completion cannot complete `mount xyz` properly
Summary: bash-completion cannot complete `mount xyz` properly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-10 23:02 UTC by *nyamo*
Modified: 2007-06-02 05:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description *nyamo* 2005-07-10 23:02:44 UTC
Anytime you have a grep alias set to "grep --color=always", bash-completion
fails to complete `mount` commands properly.  It uses the aliased grep to spit
out the possible mount locations.  Line 655 of /etc/bash_completion should have:
  /etc/fstab | grep --color=never "^$cur" ) )
along with any other "grep" instances.

Reproducible: Always
Steps to Reproduce:
1. alias "grep=grep --color=always"
2. mount / [tab]
Actual Results:  
^[\[01\;31m/^[\[00m gets spit out

Expected Results:  
/ should get spit out (along with any other possible mounts under /).
Comment 1 Aaron Walker (RETIRED) gentoo-dev 2005-07-13 05:03:30 UTC
Using --color=never is not a viable solution.  What if grep is not GNU grep?

I'm thinking more of closing this WONTFIX and updating the ebuild's pkg_postinst
instructions to state that /etc/profile.d/bash-completion should be sourced
*before* you declare anything else in ~/.bashrc, as there's no guarantee that
any aliases you set wont be a) misused unintentionally as in this case, or b)
re-set to something else by bash-completion (it does set some aliases under
certain conditions).

I am willing to listen to any alternative solutions you may have, however.
Comment 2 *nyamo* 2005-07-13 12:43:56 UTC
(In reply to comment #1)
> I'm thinking more of closing this WONTFIX and updating the ebuild's pkg_postinst
> instructions to state that /etc/profile.d/bash-completion should be sourced
> *before* you declare anything else in ~/.bashrc, as there's no guarantee that
> any aliases you set wont be a) misused unintentionally as in this case, or b)
> re-set to something else by bash-completion (it does set some aliases under
> certain conditions).

Actually, that might be a better solution to this :)  A warning at the end would
solve any other alias issues as well.
Comment 3 Aaron Walker (RETIRED) gentoo-dev 2005-07-14 00:34:47 UTC
I've updated the pkg_postinst of existing ebuilds, and made note of this bug,
giving instructions that any aliases set should be done after sourcing
/etc/profile.d/bash-completion.

Might as well mark this FIXED, since that's the reasonable resolution.
Comment 4 Kenyon Ralph 2005-07-20 10:40:31 UTC
Just setting aliases after sourcing /etc/profile.d/bash-completion doesn't mean
the alias will work.  I can't get an alias of rm='rm -iv' when bash-completion
has been sourced.
Comment 5 Kenyon Ralph 2005-07-20 11:12:16 UTC
(In reply to comment #4)
> Just setting aliases after sourcing /etc/profile.d/bash-completion doesn't mean
> the alias will work.  I can't get an alias of rm='rm -iv' when bash-completion
> has been sourced.

Nevermind, I'm experiencing Bug 99540.
Comment 6 Nilton Volpato 2007-06-02 05:30:40 UTC
Another solution or this would be to prefix grep with the bash "command" builtin, so that any aliases are ignored. This would always work, and one would not need to worry about the order of defining aliases.