Skip to content

Commit 0fc8fff

Browse files
committed
fix(rcs): avoid unexpected pathname expansion
In the current implementation, when the current word contains any glob characters, the glob pattern can match unexpected files. We instead use `_comp_expand_glob` with double-quoting the strings originating from the current word.
1 parent fa566c2 commit 0fc8fff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

completions/rcs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ _comp_cmd_rcs()
2121
COMPREPLY[i]=$dir$file
2222
done
2323

24-
_comp_compgen -aR -- -G "$dir/$file*,v"
24+
local files
25+
_comp_expand_glob files '"$dir/$file"*,v' &&
26+
_comp_compgen -aR -- -W '"${files[@]}"'
2527

2628
local i
2729
for i in ${!COMPREPLY[*]}; do

0 commit comments

Comments
 (0)