Skip to content

New systemctl list-units table format breaks zsh completions #15077

@rpigott

Description

@rpigott
$ systemctl --version
systemd 245 (245-2-arch)

It appears that the output format of systemctl --no-pager --no-legend --full list-units has changed in v245 and some zsh completions are broken as a result.

The format has changed from,

v244:

$ systemctl --no-pager --no-legend --full list-unit-files
my-unit.service loaded active running [...]
[...]

v245:

$ systemctl --no-pager --no-legend --full list-unit-files
  my-unit.service loaded active running [...]
[...]

(notice the leading spaces)

The zsh completions for systemctl use one of those magical zsh parameter expansion parsers to get an array of active units,

_systemctl_active_units() {_sys_active_units=( ${${(f)"$(__systemctl list-units "$PREFIX*" )"}%% *} )}

which is tripped up by the leading spaces, resulting in an always empty list of active units.

Steps to reproduce:

  1. Use zsh
  2. systemctl stop <TAB>

Expected: autocomplete list of active unit names
Actual: nothing

I'm guessing that the change in format is unintentional (perhaps from de9a8fe?), but if not the zsh completions could be updated to compensate. Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingsystemctl

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions