Page MenuHomePhabricator

No tab completion for `become` on dev-buster.toolforge.org
Closed, ResolvedPublic

Description

Usually, the become command has tab completion on Toolforge bastions, based on the groups of the current session:

lucaswerkmeister@tools-sgebastion-07:~$ become 
lexeme-forms            pagepile-visual-filter  speedpatrolling         wb2rdf                  wdvd                    
lexeme-senses           quickcategories         speed-patrolling        wd-image-positions      
notwikilambda           ranker                  translate-link          wd-shex-infer           

On dev-buster.toolforge.org, this completion is either not available or doesn’t work for some reason.

Event Timeline

Looks like it’s not installed:

lucaswerkmeister@tools-sgebastion-07:~$ complete -p become
complete -F _become become
lucaswerkmeister@tools-sgebastion-11:~$ complete -p become 
complete -F _minimal become

(Edit: or maybe it is installed somewhere, but Debian Buster changed the locations that are searched for tab completion?)

On the regular bastion, that completion comes from /etc/bash_completion.d/misctools, from the misctools package:

$ (shopt -s extdebug && declare -F _become)
_become 1 /etc/bash_completion.d/misctools
$ dpkg -S /etc/bash_completion.d/misctools
misctools: /etc/bash_completion.d/misctools

On dev-buster, misctools is installed but installs the completion into /usr/share/bash-completion/completions/misctools, which I guess isn’t loaded by default.

After typing misctools and then pressing Tab, become autocompletes correctly. If I understand correctly, completions in /usr/share/bash-completion/ are only loaded on-demand, so combining multiple completions into a single misctools file is not correct – they should be in files called become and sql, respectively, so that they’ll be autoloaded when trying to run autocompletion for those commands.

So I guess this might fall under the category of How Did It Ever Work stuff.
That might make it easy to fix.

I think the How It Ever Worked is that /etc/bash_completion.d/ isn’t loaded on-demand (which I guess is why it’s the legacy location and deprecated, because immediately loading all the completions takes a while)?

Change 703059 had a related patch set uploaded (by Majavah; author: Majavah):

[labs/toollabs@master] Link bash completion files for actual program names

https://gerrit.wikimedia.org/r/703059

Change 706663 had a related patch set uploaded (by Lucas Werkmeister; author: Lucas Werkmeister):

[labs/toollabs@master] Split misctools bash-completion into individual files

https://gerrit.wikimedia.org/r/706663

Change 703059 abandoned by Majavah:

[labs/toollabs@master] Link bash completion files for actual program names

Reason:

https://gerrit.wikimedia.org/r/c/labs/toollabs/+/706663/ is a much better solution to the same underlying problem

https://gerrit.wikimedia.org/r/703059

Change 706663 merged by jenkins-bot:

[labs/toollabs@master] Split misctools bash-completion into individual files

https://gerrit.wikimedia.org/r/706663

Mentioned in SAL (#wikimedia-cloud) [2021-09-27T13:01:42Z] <majavah> publish jobutils and misctools 0.43 T286072

taavi assigned this task to LucasWerkmeister.