From 1e0252fa8f6027fc7aa9a04e3a158cbc48995d91 Mon Sep 17 00:00:00 2001 From: Sibo Dong Date: Tue, 8 Jun 2021 03:33:58 -0400 Subject: [PATCH] bash-completion: localize the prev variable The prev variable is not localzed in the nmcli Bash completion script, which calls _init_completion. Even though prev does not appear in the completion script, it should still be localized. This variable may otherwise appear in the user's environment and clobber a user-defined variable of the same name, which is bad. Localize the prev variable. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/741 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/882 (cherry picked from commit 5c1181c6f3b2f56c18c1333c55e75e554b00ae2d) --- src/nmcli/nmcli-completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nmcli/nmcli-completion b/src/nmcli/nmcli-completion index 45dfe89c34..83ec1e3cb8 100644 --- a/src/nmcli/nmcli-completion +++ b/src/nmcli/nmcli-completion @@ -27,7 +27,7 @@ _nmcli_array_delete_at() _nmcli() { - local cur words cword i output + local cur prev words cword i output _init_completion || return # we don't care about any arguments after the current cursor position