Re: Bash-completion with triggers
On Thu, 07 Apr 2011, David Paleino wrote:
> Hello everybody,
> I've implemented a new revision of bash-completion, which uses debtriggers(5)
> to load only relevant completions, and symlink them when something
> touches /usr/bin/, /usr/games/, /usr/sbin/, /sbin/, /bin/, and so on.
> For this to work, the completions have been moved out from /etc/ -- they would
> be in /usr/share/bash-completion/completions/, but /etc/bash_completion.d/ is
> being kept not to break tons of other packages installing files there.
> However, I'm writing to get comments about the triggers issue. When a package
> installs an executable in one of the above directories, bash-completion's
> postinst removed all symlinks in /etc/bash_completion.d/triggered/, and
> re-creates them. The speed of such operation varies greatly depending on the
> installed packages -- on my system, it takes about 10s -- but the shell loading
> seems much faster too.
> Is there any objection to bash-completion using triggers to "watch" the
> aforementioned directories?
I feel uneasy about this. It means the trigger is going to be activated
for any package installation and all packages are going to be put in
The trigger is going to happen very often (like the man-db one) and
with a 10s impact it's very noticable...
Even if we change apt to actually keep trigger processing to the end of
the APT run, I fear that the dependency resolution logic is going to
force the trigger to run sooner and more often because a package
in trigger-awaited status does not satisfy the dependencies.
If file triggers could also specify the --no-await option that
dpkg-triggers supports, things might be different.
But in the current state, I think it's a bad idea to use file triggers
in your case.
You'd better use some apt hook to do the task you envision. A file
trigger that is activated for a majority of package installation is
probably better dealt with such a solution.
Raphaël Hertzog ◈ Debian Developer
Follow my Debian News ▶ http://RaphaelHertzog.com (English)
▶ http://RaphaelHertzog.fr (Français)