Bug 47059 - app-shells/tcsh: ignorant co[mpress] completion
Bug#: 47059 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: major Priority: P2
Resolution: FIXED Assigned To: grobian@gentoo.org Reported By: fnevgeny@weizmann.ac.il
Component: Applications
URL: 
Summary: app-shells/tcsh: ignorant co[mpress] completion
Keywords:  
Status Whiteboard: 
Opened: 2004-04-07 03:55 0000
Description:   Opened: 2004-04-07 03:55 0000
/etc/profile.d/tcsh-complete, installed AND activated by default in gentoo, is,
apparently, an example taken from the tcsh distro which was hardly supposed to
be used as is. E.g., the annoying thing I noticed today is the ambiguous
completion statement:

complete -co*      p/0/"(compress)"/

(with the bold comment "make compress completion not ambiguous"), which results
in shadowing any other commands beginning with "co".


Reproducible: Always
Steps to Reproduce:
1. Type "co" at the prompt
2. Press [Tab]

Actual Results:  
> compress 

Expected Results:  
> co
col                 column              composite           convcal
colcrt              comm                compress            convert
collateindex.pl     compile_et          conglomerate        
colorize            complete            conjure             
colrm               complete-ant-cmd.pl continue            


In general, the situation with tcsh in Gentoo is pathetic (see e.g. bugs
#17852,
#35434). It may be a result of the credo "move all to the paradise of bash with
the mighty hand" by some of developers - which could be discussed but is hardly
worth to be implemented this way.

------- Comment #1 From Nick Hadaway 2004-06-07 21:47:31 0000 -------
I have made this change.  Are there any other change you think would be
sensible to make?  Please be specific.

------- Comment #2 From Evgeny Stambulchik 2004-06-07 23:01:27 0000 -------
Well, there are a few other issues with tcsh-complete. E.g. $hosts defaults to
a list of US universities (and parsing of .ssh/known_hosts is wrong, as it
presents a list of "host,ip" entries among others), `gs' has a pretty short
list of possible devices (and part of them not compiled in usually) etc etc. I
suggest to limit the contents of the file to a list of _really_ sensible and
_safe_ completions, e.g. `cd' expands its args to directories only, and the
rest be sourced optionally at user's will.
BTW, a dangerous completion logic is enabled for `rm'. It's "smart" to not
suggest removing .[c,h] and some other source files. Now a real-life
experience: a user wanted to clean his work directory, typed "rm -f [TAB]", saw
some .o junk and nothing important, added "*" and pressed [Enter]... Luckily,
everything was backed up, but others might be less happy...

------- Comment #3 From Markus Baumeister 2004-11-02 12:54:06 0000 -------
A few more changes for /etc/profile.d/tcsh-settings:

set correct=cmd
unset autocorrect
set complete

The current setting of 'correct=all' and 'complete=enhaced' leads to all kinds funny effects, which quickly become less funny when you actually try to work. E.g.:

Try to complete 'mail':
---- snip ----
/home/baumeist> mai [TAB]
Mail         Mail/        MailArchive/ mail         mail-files   mailmail     mailq        mailshar     mailx
/home/baumeist> Mail
--- snip ----
(Requires to have a 'Mail' directory in $HOME)
Note that you end up with a capital 'M' which forces you to go back to the first letter, remove it and replace it with a small 'm'.

Also nice is 'sudo':
----- snip -----
/home/baumeist> sudo emerge --search foo [RET]

CORRECT>sudo .merge --search foo (y|n|e|a)?
----- snip -----
(Requires to have a '.merge' directory in $HOME)

With the current settings tcsh autocompletion and correction is no longer an advantage but an annoyance. Default settings should follow the principle of least surprise for new users (unless the intention is indeed to drive everyone to bash).
 
In addition - as mentioned above - /etc/profile.d/tcsh-completion should be seriously trimmed down. Otherwise it becomes a maintenance nightmare. Does anyone really intend to administer entries like 'complete gcc' where each new gcc option would require a change to its entry? Alas, I have no better version handy.

BTW, The bug mentioned in the start of this thread still exists. co [TAB] expands to only 'compress' here. The solution to that bug is to remove the 'complete -co*' line from /etc/profile.d/tcsh-completion. Or, for anyone not able to edit that file, to put an 'uncomplete -co*' in one's .cshrc .

------- Comment #4 From Evgeny Stambulchik 2005-05-10 05:12:54 0000 -------
Anybody alive here? The bug is STLL there after more than a year since the
submission!

------- Comment #5 From Guy Martin 2005-05-12 09:19:02 0000 -------
Guys, not sure why this bug is mine but I don't use tcsh. People working on OOo
should know this thing better than me.

------- Comment #6 From Jakub Moc (RETIRED) 2005-09-04 02:43:49 0000 -------
Argh, damned bugzilla jumping on next found bug again. Re-assigning back, sorry
for the noise.

------- Comment #7 From Fabian Groffen 2005-09-13 11:45:22 0000 -------
hmmm, I found the defaults annoying as well, but I just switched the auto
completion thing off, and defined my own in .tcshrc.  Maybe we should just
disable the options by default and give a pointer to the tcsh-complete file, as
it was meant as example file, IMHO.  Indeed there need to be patched some
examples out there...

------- Comment #8 From Fabian Groffen 2005-09-27 12:20:44 0000 -------
note to self: done

------- Comment #9 From Fabian Groffen 2005-09-30 12:38:12 0000 -------
Fixed in 6.14-r1