kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

Localize shell variable REPLY to avoid overwriting users' value #489

Closed akinomyoga closed 3 weeks ago

akinomyoga commented 3 weeks ago

The shell function __python_argcomplete_scan_head in the completion setting (argcomplete/bash_completion.d/_python-argcomplete) uses the read builtin without specifying variable names. This stores the read result in the shell variable REPLY. Then, __python_argcomplete_scan_head checks the value of REPLY. A problem is that this will clobber the users' values of the global shell variable REPLY on an attempt of completion. We should declare the REPLY as a local variable in the shell function __python_argcomplete_scan_head.

kislyuk commented 3 weeks ago

Thanks!

akinomyoga commented 2 weeks ago

Thank you!