summaryrefslogtreecommitdiffstats
path: root/shell-completion/bash/systemd-cgls
diff options
context:
space:
mode:
authorSibo Dong <dongsibo@users.noreply.github.com>2021-04-03 05:33:59 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-06 16:15:13 +0200
commitf34173a048061b3f7e551e9a7c04f00e5a106fac (patch)
tree16969104c7d906495094884497ab70324fea2c51 /shell-completion/bash/systemd-cgls
parentsysusers/firstboot: temporarily disable LoadCredential (diff)
downloadsystemd-f34173a048061b3f7e551e9a7c04f00e5a106fac.tar.xz
systemd-f34173a048061b3f7e551e9a7c04f00e5a106fac.zip
bash-completion: localize words and cword variables
The words and cword variables are not localized in all Bash completion scripts that call _init_completion. cur, prev, words, and cword (and split if using the -s flag) are all variables that should be localized in Bash completion scripts before calling _init_completion (even if they don't otherwise appear in the calling script). This is done for cur and prev, but not for words and cword. Letting words and cword remain unlocalized may clobber variables the user is using for other purposes, which is bad. This issue can be resolved by declaring words and cword as local variables. Resolves #19188.
Diffstat (limited to 'shell-completion/bash/systemd-cgls')
-rw-r--r--shell-completion/bash/systemd-cgls2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls
index 7caaf89ddb..0b6a8fda0d 100644
--- a/shell-completion/bash/systemd-cgls
+++ b/shell-completion/bash/systemd-cgls
@@ -37,7 +37,7 @@ __get_units_have_cgroup() {
}
_systemd_cgls() {
- local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
local i verb comps
local -A OPTS=(