[Bug 790043] Re: Bash-completion slows up the start of bash

Peter Cordes peter at cordes.ca
Mon Dec 1 20:50:56 UTC 2014


@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...

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash-completion in Ubuntu.
https://bugs.launchpad.net/bugs/790043

Title:
  Bash-completion slows up the start of bash

Status in bash-completion package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: bash-completion

  I have been noticing that bash has unusually slow start-up times.
  After looking into the problem, I found out this is mostly caused by
  the execution of /etc/bash_completion (calls to this exist in several
  places). Of course, removing them speeds up the start but leaves a
  less functional shell. As a work-around I would like to suggest
  starting up /etc/bash_completion in the background. In this way, bash
  will start quickly, have access only to basic built-in completions for
  the first 2 seconds until /etc/bash_completion finishes executing.

  ProblemType: Bug
  DistroRelease: Ubuntu 11.04
  Package: bash-completion 1:1.3-1ubuntu3
  ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
  Uname: Linux 2.6.38-8-generic x86_64
  Architecture: amd64
  Date: Sun May 29 22:43:51 2011
  EcryptfsInUse: Yes
  PackageArchitecture: all
  ProcEnviron:
   LANGUAGE=en_US.UTF-8:en
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: bash-completion
  UpgradeStatus: Upgraded to natty on 2011-04-24 (35 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/790043/+subscriptions



More information about the foundations-bugs mailing list