Comment 6 for bug 790043

Revision history for this message
Peter Cordes (peter-cordes) wrote :

@Atanas: interesting idea to have bash load completions in the background, but shell scripting as a language has NO support for doing anything like this. You can't just have it happen in another thread, because you need it to modify the context of the CURRENT shell.

  You'd need a new major feature to read a stream of commands from a file in the background and have it modify the current shell environment. It would either have to have a whole bunch of arbitrary rules, like you aren't allowed to cd / pushd / popd, or you'd introduce a lot of potential weirdness, and huge amounts of corner cases to figure out what should happen if the background command stream did something at the same time as the normal command stream.

 maybe if you restricted the commands allowed to just function definitions, and use of the complete shell builtin, that would make it viable. But the current bash_completion goes and sources everything in /etc/bash_completion.d, which means it had to have some commands run (e.g. the source builtin, and some logic to blacklist acroread.sh).

 So it's theoretically doable, but it would be a lot of work for something that is finally not really an issue, even on hardware that's a bit old by today's standards. Basically, it's not pretty, but luckily most people have fast CPUs. And hopefully not too many separate files to generate hard drive bottlenecks with magnetic drives that seek slowly...