Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 53811 - bash-completion (any version) causes bash to hang on "wrong usage"
Summary: bash-completion (any version) causes bash to hang on "wrong usage"
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Christian Birchinger (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-13 07:50 UTC by antoine marmignon
Modified: 2005-04-04 14:22 UTC (History)
2 users (show)

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


Attachments
Make bash-completion abort attempts to complete 'man' from nothing (bash_completion_no_full_manual_expansion.patch,281 bytes, patch)
2004-06-18 11:35 UTC, Peter Jensen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description antoine marmignon 2004-06-13 07:50:05 UTC
Assuming you are using bash-completion to view the procmailrc man page:
You type man procmail<TAB><TAB>
Then the terminal shows available choices (procmail, procmailex, procmailrc, procmailrc on my system)
If you choose procmailrc and incidentally hit <TAB> then bash will hang with 100% cpu usage.
This can be reproduced with any command.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Peter Jensen 2004-06-13 09:14:12 UTC
It's trying to complete from nothing, which is a *very* lengthy procedure in this case.
My system has 12130 man pages, and despite having a 1.5GHz computer the completion procedure still takes 3-4 minutes.
It *does* eventually complete, but I usually just stop it with ctrl+C.
A solution would be to stop it from attemting completion if it has to complete from nothing.
I don't know enough about bash completion syntax to do it, though.
Comment 2 Christian Birchinger (RETIRED) gentoo-dev 2004-06-13 15:56:26 UTC
It's like Peter just said. It tries to complete everything. Some completion code
requires more CPU than without bash-completion loaded. I don't see how this should be fixed by the bash-completion or even the Gentoo developers.

That's how bash and it's completion works. I'm happy that ctrl-c works to abort
such functions. But i cannot fix this behavior. You'd have to change bashs core functionality which i can't do. It's annoying but such fundemental bash basic functions can't me fixed by us.
Comment 3 Peter Jensen 2004-06-18 11:31:44 UTC
Actually, it *can* be fixed.  Or, at least we can prevent it from completing from nothing, which is more or less useless anyway.
It's quite simple, actually.  All that's needed is this line somewhere in the beginning of _man():

[ -z $cur ] && return 0

If nobody can give a good reason why one should want to wait minutes for completion of all manuals on the system, I suggest this be added.
Comment 4 Peter Jensen 2004-06-18 11:35:25 UTC
Created attachment 33514 [details, diff]
Make bash-completion abort attempts to complete 'man' from nothing

This patch against /etc/bash_completion works for me.
No more seemingly endless hangs :-)
Comment 5 Adam 2005-04-04 14:22:04 UTC
> If nobody can give a good reason why one should want to wait minutes for completion of all manuals on the system, I suggest this be added.

Well, I don't expect that you'll consider this a good reason, but in my opinion it isn't good to have special cases like this.  Maybe some people don't have many man pages or will eventually get a computer fast enough that the wait time is OK for them.  It might be useful to be able to see all man pages on your system and choose the one you want; I personally complete from nothing when looking at the files in a folder sometimes.  There are many commands which could be considered so slow that no one would ever want to complete them; should we go around guessing an appropriate cutoff for all of them?

It doesn't particularly bother me that you've set up the completion for man this way, but in general, it wouldn't be what I'd have done.  Ideally bash should have some kind of "busy" indicator while a completion is taking place, since there's no telling how long it will take, but in general I don't think it's good to work around deficiencies in other programs.