Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash completion variable leak fixes #1352

merged 1 commit into from Feb 18, 2021


Copy link

@scop scop commented Feb 14, 2021

split is from bash_completion's _init_completion -s.

Copy link

@jpmcb jpmcb commented Feb 15, 2021

Hi @scop can you give further detail on what you're seeing and what the problem is? Any further detail would be appreciated!!

Copy link
Contributor Author

@scop scop commented Feb 15, 2021

Without localising the affected variables in this PR, invoking a completion overwrites their global values in the current shell. This either

  1. causes problems of varying extents by overwriting contents of those variables the user has set in their shell for whatever reason, or
  2. needlessly pollutes the shell with the variables if they weren't already in it

An example of 1), with imaginary foo command having cobra's completion:

$ split=something
$ foo <kbd>Tab</kbd>
some completions go here
$ ^C
$ echo $split

Same thing happens to command_aliases and noun_aliases.

jpmcb approved these changes Feb 18, 2021
Copy link

@jpmcb jpmcb left a comment

Good catch! And thanks for the contribution 🚀

@jpmcb jpmcb merged commit eb3b639 into spf13:master Feb 18, 2021
7 checks passed
@scop scop deleted the bash-completion-variable-leak branch Feb 18, 2021
@marckhouzam marckhouzam mentioned this pull request May 4, 2021
@renovate renovate bot mentioned this pull request Jul 1, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants