Bug 1491668 - systemctl bash completion is horribly slow
Summary: systemctl bash completion is horribly slow
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 28
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-14 11:44 UTC by Pierre Ossman
Modified: 2019-05-06 09:18 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-04 16:45:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Pierre Ossman 2017-09-14 11:44:43 UTC
Right now the bash completion for systemctl is so slow that it is generally worse than having nothing at all. Even simple things take several seconds to complete, and there is no feedback since completions are expected to be quick.

E.g.

  systemctl enable ssh<tab>

often takes long enough that I regret tabbing and would have completed it faster by typing manually.

The more possible completions the worse it seems to get.

systemd-233-6.fc26.x86_64

Comment 1 Fedora End Of Life 2018-05-03 07:51:00 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 2 Peter Hostačný 2018-07-14 23:03:49 UTC
Please fix this issue or disable the autocompletion.

Comment 3 Frantisek Sumsal 2018-07-16 11:55:45 UTC
I'd say it's a similar (or maybe the same) issue as https://github.com/systemd/systemd/issues/8216. If you don't want autocomplete for the systemctl command, you can disable it with:

$ complete -F systemctl -r

Comment 4 Ben Cotton 2018-11-27 14:59:29 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Sam McLeod 2019-01-18 02:50:48 UTC
- Patch from: [UHUsystems.com] (https://uhusystems.com/)
- Maintainer: Janos Strbik janos.strbik

---

- Problem: bash completion of systemctl command is very slow or totally hanged up for minutes in case of a great number of systemd units (>250).
- Reason: Completion routines calls systemctl as times as many systemd units exist.
- Solution: Patch file `/usr/share/bash-completion/completions/systemctl` as the following:

```patch
22c22
<         systemctl $mode --full --no-legend "$@"
---
>         systemctl $mode --full --no-legend --no-pager "$@"
44a45,48
> 
> #
> # UHU PATCH Tue Mar 14 18:50:31 CET 2017 {
> #
46,49c50,53
<             <(__systemctl $mode show --property "$property" -- "${units[@]}")
<         for ((i=0; $i < ${#units[*]}; i++)); do
<                 if [[ "${props[i]}" = "$property=$value" ]]; then
<                         echo " ${units[i]}"
---
>             <(__systemctl $mode show --property Names,"$property" -- \*)
>         for ((i=0; $i < ${#props[*]}; i=i+2)); do
>                 if [[ "${props[i+1]}" = "$property=$value" ]]; then
>                         echo " ${props[i]#Names=}"
51a56,59
> #
> # } UHU PATCH Tue Mar 14 18:50:31 CET 2017
> #
> 
```

Source: https://www.reddit.com/r/systemd/comments/5ze9jz/systemd_systemctl_bash_completion_is_very_slow_or/

Comment 6 Ben Cotton 2019-05-02 19:59:17 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Zbigniew Jędrzejewski-Szmek 2019-05-04 16:45:35 UTC
Sorry we couldn't get this. If you have suggestions how to improve the completion
scripts, please submit a PR upstream at https://github.com/systemd/systemd/.
There have been various improvements made upstream in the meantime, please check
if things work better for you with recent systemd versions.

Comment 8 Pierre Ossman 2019-05-06 09:18:02 UTC
It does indeed seem to be faster. This is on Fedora 29 with systemd-239-12.git8bca462.fc29.x86_64. Thanks!


Note You need to log in before you can comment on or make changes to this bug.