-
Notifications
You must be signed in to change notification settings - Fork 379
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
xspec is ignored when Bash option force_fignore
is unset
#1229
Comments
This seems to be caused by $ compgen -d
$ shopt -u force_fignore
$ compgen -d
foo.a
foo.c
foo.h |
Well spotted! However I believe your finding with $ env -i bash --noprofile --norc
bash-5.2$ ls
foo.a foo.c foo.h
bash-5.2$ compgen -f -X '*.[aoc]' foo
foo.h
bash-5.2$ compgen -f -X '*.[aoch]' foo
(no completion, as expected)
bash-5.2$ shopt -u force_fignore
bash-5.2$ compgen -f -X '*.[aoc]' foo
foo.h
bash-5.2$ compgen -f -X '*.[aoch]' foo
(no completion, as expected) Which shows this is a different bug than the one I originally reported above (and which also happens when the current directory contains a directory). On the other hand, your finding might be a hint that the |
My previous example is obtained by reducing the reported behavior in
Please check the behavior of |
The fix was already merged in the upstream Bash. It will be released in Bash 5.3. Although the problem isn't fixed in Bash <= 5.2, the problem is rather minor and only happens with a custom setting |
Describe the bug
For instance with vim completion; vim completion uses
_comp_compgen_filedir_xspec
, and${_comp_xspecs[vim]}
is equal to'*.@([ao]|so|...)'
(meaning that vim completion should not suggest files matching*.a, *.o, *.so
).The xspec is seemingly ignored when Bash option
force_fignore
is unset. In other words, files matching*.a, *.o, *.so
are suggested.Perhaps
_comp_compgen_filedir
is affected too.To reproduce
Expected behavior
Suggestions returned by bash-completion should not depend on the state of Bash option
force_fignore
.As far as I understand, the FIGNORE feature of Bash is a post-filtering applied by Bash after the custom completion command (that is, bash-completion) has run, so both should be totally independent.
What’s even stranger is that the state of
force_fignore
is only relevant when there is only one suggestion, but in the repro case, several suggestions are returned after filtering (foo.c
andfoo.h
).Versions (please complete the following information)
Debug trace
debug.txt
The text was updated successfully, but these errors were encountered: