You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the original codes, we called `eval ls $list` where $list contains
a string from $cur. This would execute command substitutions in the
command line such as '$(echo hello >/dev/tty)'. We want to avoid
eval'ing the string from the command line. Also, this does not work
when the filenames or directory names contain white spaces or
newlines.
In this patch, we instead perform the pathname expansions built in
Bash through the utility `_comp_expand_glob`.
Note: In the original code, when $cur is empty, we made `ls' to expand
the content of the directory. Now, we use the pathname expansions so
need to add `*' at the end of the pattern even with an empty $cur.
Note: The reason that the original code used `ls` seems to be to
select only the paths with existing files. This is effectively
replaced by `shopt -s nullglob` set inside `_comp_expand_glob` in the
new code.
0 commit comments