Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] bash-completion-2.1-r1 once again
Date: Tue, 26 Aug 2014 10:51:48
Message-Id: 20140826125122.59f48598@pomiot.lan
1 Hello, developers and users.
2
3 I would like to champion the goal of bringing bash-completion-2.1-r1 to
4 Gentoo. As far as I can see, nobody's been working on this since
5 the first failed attempt has been reverted.
6
7 Firstly, I would like to describe the differences between the old
8 and the new system.
9
10
11 The old system
12 --------------
13
14 compatdir = /etc/bash_completion.d
15 oldcompdir = /usr/share/bash-completion
16
17 1. Completions and other completion-like files are installed
18 in $oldcompdir.
19
20 2. On start, bash sources all files from $compatdir, explicitly
21 enabling completions inside them.
22
23 3. 'eselect bashcomp' enables completions through linking files
24 from $oldcompdir to $compatdir.
25
26
27 What's wrong with the old system?
28 ---------------------------------
29
30 Well, the major issue with the old system is that for completion to
31 work, it needs to loaded at start of bash. The more completions you
32 enable, the more files bash needs to source and the more memory
33 consumed.
34
35 If you enable all completions by default, bash would need to load a lot
36 of functions, most of them not even used during the session.
37
38
39 The new system
40 --------------
41
42 completionsdir = /usr/share/bash-completion/completions
43
44 1. Completions are installed in $completionsdir and named after
45 the commands they complete. If a single completion matches more than
46 one command, symlinks to additional names need to be created.
47
48 2. On start, bash sources only completion autoloader. The loader
49 automatically loads completions for commands that do not have any
50 completions defined yet.
51
52 3. Completions are enabled by default. 'eselect bashcomp' handles
53 disabling specific completions through Gentoo-specific instance of
54 blacklist.
55
56
57 What's good about the new system?
58 ---------------------------------
59
60 The key feature of the new system is that the completions are loaded
61 on-demand. In other words, we can basically enable all completions by
62 default without making bash slow or memory-consuming -- at least, until
63 user tries to use all the completed commands ;).
64
65 I should note here that the completions are loaded to fill
66 the parameters to a command rather than the command itself. That is:
67
68 $ xr[tab]
69
70 won't load any completions yet. However:
71
72 $ xrandr [tab]
73
74 will try to load ${completionsdir}/xrandr. If such a file doesn't exist
75 or is blacklisted, generic completions will be used.
76
77
78 What needs to change?
79 ---------------------
80
81 The major issue is how to switch the system properly -- preferably,
82 without forcing users to reinstall everything :).
83
84 I think the best way forward is to:
85
86 1. Teach 'old' eselect-bashcomp to find files in the new $completionsdir
87 as well as the old location, and stabilize that soon.
88
89 2. Switch the eclass and ebuilds to use the new $completionsdir. While
90 at it, make sure that ebuilds install completion files whose names
91 conform to the new layout (portage QA check likely).
92
93 3. Do we need some specific documentation except for a regular news
94 item? Where?
95
96 4. Unmask the new bash-completion and eselect-bashcomp. Add a news item
97 explaining the sudden change :).
98
99 Any comments? Doubts? Wishes?
100
101 --
102 Best regards,
103 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] bash-completion-2.1-r1 once again Joshua Kinard <kumba@g.o>
Re: [gentoo-dev] bash-completion-2.1-r1 once again Alexander Tsoy <alexander@××××.me>
Re: [gentoo-dev] bash-completion-2.1-r1 once again "Michał Górny" <mgorny@g.o>