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 /).
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.
(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.
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.
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.
(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.
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.