junegunn / junegunn/fzf

Bash completions conflicts with globstar setting

Open
#1,127 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
83k
Forks
2.9k
Avg merge
17h 8m
Merged PRs (30d)
10

Description

- Category
- [ ] fzf binary
- [ ] fzf-tmux script
- [ ] Key bindings
- [x] Completion
- [ ] Vim
- [ ] Neovim
- [ ] Etc.
- OS
- [x] Linux
- [ ] Mac OS X
- [ ] Windows
- [ ] Windows Subsystem for Linux
- [ ] Etc.
- Shell
- [x] bash
- [ ] zsh
- [ ] fish

Running with bash, when you type:
```
$ source /usr/share/fzf/shell/completion.bash

$ shopt -u globstar # this allows you to use ** for recursive files/directory expansion

$ ssh **
```
it correctly uses fzf to show you a list of hosts where you can connect to.

The problem arises when you cancel the search with `Ctrl-C`. Then bash will try to evaluate `**` as a globstar pattern and will traverse the whole tree under your current working directory. If you run it from $HOME it blocks the whole shell for a couple of minutes (depends on your disk usage).

In my opinion, the correct behavior should be not trying to do any more completion after you cancel the fzf. That's the behavior in zsh and fish.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with shell/completion.bash and reproduce the bash sequence using `ssh ** ` after cancelling fzf with Ctrl-C. Trace how completion cancellation returns control to bash; done means cancelling does not trigger recursive glob expansion or block the shell, while normal host completion still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.