Hello, developers and users.

I would like to champion the goal of bringing bash-completion-2.1-r1 to
Gentoo. As far as I can see, nobody's been working on this since
the first failed attempt has been reverted.

Firstly, I would like to describe the differences between the old
and the new system.


The old system
--------------

compatdir = /etc/bash_completion.d
oldcompdir = /usr/share/bash-completion

1. Completions and other completion-like files are installed
in $oldcompdir.

2. On start, bash sources all files from $compatdir, explicitly
enabling completions inside them.

3. 'eselect bashcomp' enables completions through linking files
from $oldcompdir to $compatdir.


What's wrong with the old system?
---------------------------------

Well, the major issue with the old system is that for completion to
work, it needs to loaded at start of bash. The more completions you
enable, the more files bash needs to source and the more memory
consumed.

If you enable all completions by default, bash would need to load a lot
of functions, most of them not even used during the session.


The new system
--------------

completionsdir = /usr/share/bash-completion/completions

1. Completions are installed in $completionsdir and named after
the commands they complete. If a single completion matches more than
one command, symlinks to additional names need to be created.

2. On start, bash sources only completion autoloader. The loader
automatically loads completions for commands that do not have any
completions defined yet.

3. Completions are enabled by default. 'eselect bashcomp' handles
disabling specific completions through Gentoo-specific instance of
blacklist.


What's good about the new system?
---------------------------------

The key feature of the new system is that the completions are loaded
on-demand. In other words, we can basically enable all completions by
default without making bash slow or memory-consuming -- at least, until
user tries to use all the completed commands ;).

I should note here that the completions are loaded to fill
the parameters to a command rather than the command itself. That is:

  $ xr[tab]

won't load any completions yet. However:

  $ xrandr [tab]

will try to load ${completionsdir}/xrandr. If such a file doesn't exist
or is blacklisted, generic completions will be used.


What needs to change?
---------------------

The major issue is how to switch the system properly -- preferably,
without forcing users to reinstall everything :).

I think the best way forward is to:

1. Teach 'old' eselect-bashcomp to find files in the new $completionsdir
as well as the old location, and stabilize that soon.

2. Switch the eclass and ebuilds to use the new $completionsdir. While
at it, make sure that ebuilds install completion files whose names
conform to the new layout (portage QA check likely).

3. Do we need some specific documentation except for a regular news
item? Where?

4. Unmask the new bash-completion and eselect-bashcomp. Add a news item
explaining the sudden change :).

Any comments? Doubts? Wishes?

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to