[Bash-completion-devel] Bug#430501: /etc/skel/.bashrc: bash_completion example in default .bashrc should check for previous inclusion via $BASH_COMPLETION

Josh Triplett josh at joshtriplett.org
Mon Apr 12 19:40:34 UTC 2010


On Sat, Apr 10, 2010 at 01:20:19PM +0200, David Paleino wrote:
> On Saturday 10 April 2010 13:16:29, Matthias Klose wrote:
> > On 10.04.2010 12:12, David Paleino wrote:
> > > On Saturday 10 April 2010 12:00:17, Matthias Klose wrote:
> > >> reassign 430501 bash-completion
> > >> thanks
> > >>
> > >> I think that's the wrong thing to do. Resourcing the .bashrc should
> > >> include all parts. if bash-completion is not safe to resource, please
> > >> have a guard in bash-completion instead.
> > >
> > > What's wrong with:
> > >
> > > [ -f /etc/bash_completion ]&&  . /etc/bash_completion
> > >
> > > ?
> > 
> > if that does work, then nothing is wrong. what do you think is wrong?
> 
> Nothing, and I can't see why we should check for BASH_COMPLETION whatsoever 
> (re the original bugreport).

I don't see anything in /etc/bash_completion that prevents sourcing it
twice, and even if it works idempotently, that wastes a lot of time.  I
suggested checking for duplicate sourcing via $BASH_COMPLETION so that
if both ~/.bashrc and /etc/bash.bashrc source /etc/bash_completion, it
doesn't run twice and take twice as long.  I do agree that
/etc/bash_completion seems like a better place to put this check, but I
think *something* should check rather than duplicating work.

- Josh Triplett





More information about the Bash-completion-devel mailing list