You are not logged in.

#1 2010-11-22 23:19:36

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 1,958
Website

speed up sourcing /etc/bash_completion?

$ time . /etc/bash_completion

real    0m0.774s
user    0m0.473s
sys    0m0.037s

This is with a hot cache.  And happens everytime you start a shell (see /etc/bash.bashrc)
Is there a way to speed this up? I thought there was a bugticket about this at some point, but couldn't find it back.
I thought there was a trick like loading only completion files for stuff you actually use, but google isn't very helpful.
For now I'm experimenting with backgrounding sourcing the completion, which seems to work.

edit: backgrounding doesn't seem to work so well after all.
I kept getting `bash: __git_ps1: command not found` (i use this in my $PS1), i thought it was only the first time it would show PS1, but it does it all subsequent times as well.

Last edited by Dieter@be (2010-11-22 23:28:19)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#2 2010-12-16 21:14:58

hamelg
Member
From: France
Registered: 2008-06-19
Posts: 91

Re: speed up sourcing /etc/bash_completion?

So, now with core/filesystem 2010.12-1, /etc/bash_completion is sourced twice by /etc/profile :
. in /etc/profile.d/bash_completion.sh
. in /etc/bash.bashrc

The workaround is to remove read permission to /etc/profile.d/bash_completion.sh : chmod 0 /etc/profile.d/bash_completion.sh

Offline

#3 2010-12-16 23:47:17

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: speed up sourcing /etc/bash_completion?

Given that /etc/bash.bashrc is a file written and provided by Arch, it should be removed from there. This file should never even consider if /etc/bash_completion is on the system. /etc/profile.d/bash_completion.sh is a file provided by upstream (bash-completion) and it should be what provides completion.

Offline

#4 2010-12-17 00:36:51

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,327
Website

Re: speed up sourcing /etc/bash_completion?

File a bug report and I will get to fixing that eventually.  All the configuration files provided by bash really need a complete review...

Offline

Board footer

Powered by FluxBB