mirror of
https://github.com/systemd/systemd.git
synced 2024-11-24 02:33:36 +08:00
shell-completion: zsh: fix incorrect unescaping
Previously the `_filter_units_by_property` completion function
outputs with a [zsh parameter expansion flag] `g⭕`. This means
that the returned result is unescaped as the zsh builtin `echo`,
except that octal escapes don’t take a leading zero. This seemed to
have worked back in the days when it was first introduced:
6c9414a700
But it now leads to incorrect over-unescaping; for example,
system-systemd\\x2djournald.slice (correct)
is incorrectly completed by zsh in commands such as
`systemctl kill`:
system-systemd-journald.slice (incorrect)
This commit fixes such problems by removing the `g⭕` flag.
See:
[zsh parameter expansion flag]: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion-Flags
This commit is contained in:
parent
24c2e04e9a
commit
3ceb4d2438
@ -190,7 +190,7 @@ __systemctl()
|
||||
local -a units; units=("${(q-)@}")
|
||||
local -A props
|
||||
props=(${(f)"$(_call_program units "$service $_sys_service_mgr show --no-pager --property=\"Id,$property\" -- ${units} 2>/dev/null")"})
|
||||
echo -E - "${(@g:o:)${(k@)props[(Re)$property=$value]}#Id=}"
|
||||
echo -E - "${(@)${(k@)props[(Re)$property=$value]}#Id=}"
|
||||
}
|
||||
|
||||
(( $+functions[_systemctl_get_non_template_names] )) ||
|
||||
|
Loading…
Reference in New Issue
Block a user