bash-completion-Bugs item #314417 was changed at 2013-09-06 12:56 by Ville Skyttä You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314417&group_id=100114
Status: Open Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: completion for cc and c++ does not work Distribution: Ubuntu Originally reported in: None Milestone: None Status: None Original bug number: Initial Comment: Anonymous message posted by corbellini.and...@gmail.com Typing "cc <TAB>" at the bash prompt does not give any hint. The problem lies in the following piece of /usr/share/bash-completion/completions/cc: complete -F _gcc gcc g++ g77 gcj gpc &&{ cc --version 2>/dev/null | grep -q GCC && complete -F _gcc cc || : c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || : } "cc/gcc/c++/g++ --version" do not print GCC, therefore the completion for cc/c++ is never installed. I suggest to use this check instead: [[ "$(readlink -f /usr/bin/cc)" == "$(readlink -f /usr/bin/gcc)" ]] However a problem still remains: when cc is not GCC, there is no completion. Therefore || : should be replaced with || complete -F _minimal cc ---------------------------------------------------------------------- >Comment By: Ville Skyttä (scop-guest) Date: 2013-09-06 12:56 Message: print_version uses pkgversion_string in its output, and that's controlled by gcc's configure script, "GCC" being the default: $ ./configure --help | grep pkgversion --with-pkgversion=PKG Use PKG in the version string in place of "GCC" Assuming gcc if --version contains "Ubuntu" would be one way to approach this, but doesn't give me a warm fuzzy feeling. And yes, not falling back to _minimal for non-gcc is a bug, will fix. ---------------------------------------------------------------------- Comment By: Andrea Corbellini (andrea.corbellini-guest) Date: 2013-09-06 11:05 Message: > Our cc completion is specifically a gcc one, so we explicitly do not want to > install it to anything else but gcc. My cc is gcc. Also, it's true that you support just gcc, but you should also handle the case where gcc is not installed (and use _minimal in that case). > And the suggested readlink approach is flawed in multiple ways, readlink -f > is not portable (the _realcommand() function could be used instead of it), > and the binaries might not be in /usr/bin. > > If your cc --version (assuming cc is gcc) output doesn't contain GCC, what > does it output? cc (Ubuntu/Linaro 4.8.1-9ubuntu1) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. And it should be the same for everyone: http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/gcc.c?view=markup (look for "if (print_version)"). ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2013-09-06 10:40 Message: Our cc completion is specifically a gcc one, so we explicitly do not want to install it to anything else but gcc. And the suggested readlink approach is flawed in multiple ways, readlink -f is not portable (the _realcommand() function could be used instead of it), and the binaries might not be in /usr/bin. If your cc --version (assuming cc is gcc) output doesn't contain GCC, what does it output? ---------------------------------------------------------------------- You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314417&group_id=100114 _______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel