bash-completion icon indicating copy to clipboard operation
bash-completion copied to clipboard

bash programmable_completion: possible retry loop

Open bmatcuk opened this issue 4 years ago • 3 comments
trafficstars

Describe the bug

I have the following alias in my .bash_profile because I like the verbose output most of the time: alias rm='rm -v'. However, sometimes I want to skip all that output - deleting a node_modules directory, for example. So, I'll start my command with a backslash to skip the alias, like: \rm -drf node_modules.

I recently upgraded to bash-completion v2.11 via homebrew and started getting -bash: warning: programmable_completion: \rm: possible retry loop if I try to tab-complete something like \rm -drf nod<tab>. At first, I thought the problem was fzf because the problem would stop if I disabled fzf's auto-complete script and filed a ticket here. However, while trying to come up with a minimal repro for fzf, I discovered that it's only reproducible with bash-completion v2.11 + any version of fzf.

To reproduce

Here's a minimal repro using Docker:

Dockerfile:

FROM debian:buster-slim
RUN apt-get update && apt-get install -y autoconf curl git make

RUN git clone https://github.com/scop/bash-completion.git ~/bash-completion
RUN cd ~/bash-completion && git checkout 2.11 && autoreconf -i && ./configure && make && make install

RUN git clone https://github.com/junegunn/fzf.git ~/.fzf
RUN cd ~/.fzf && git checkout 0.27.0 && ./install

COPY .bashrc /root

.bashrc:

[ -f /usr/local/etc/profile.d/bash_completion.sh ] && source /usr/local/etc/profile.d/bash_completion.sh
[ -f ~/.fzf.bash ] && source ~/.fzf.bash

Place the Dockerfile and .bashrc in the same directory. Then, build, run the docker container, and test such as:

docker build -t test .
docker run -it test /bin/bash
cd ~
mkdir test
\rm -drf te<tab>

Expected behavior

Tab-completion should work without error.

Versions (please complete the following information)

  • [x] Operating system name/distribution and version: OSX 10.15.7 and Debian Buster tested
  • [x] bash version, echo "$BASH_VERSION": 5.1.4 and 5.0.3 tested
  • [x] bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.11

Additional context

Debug trace

In the trace, I had typed \rm -drf fz<tab>:

trace.txt

bmatcuk avatar May 04 '21 20:05 bmatcuk

Thanks for the thorough report. I'd like to clarify one thing, will try to have an actual look soonish unless someone beats me to it:

I recently upgraded to bash-completion v2.11 via homebrew and started getting [...]

Do you have a record what version was your bash-completion before this upgrade, i.e. one that did not provoke this error?

scop avatar May 04 '21 20:05 scop

Sadly, no. But, I tried other versions in the Dockerfile I posted above (you can see the git checkout 2.11 in the Dockerfile - I tried other versions there) and only 2.11 exhibits the issue.

bmatcuk avatar May 05 '21 02:05 bmatcuk

Bisected, a03d69016eafd08acfeefc29b6b2399bce83c4d2 triggers it. Haven't checked beyond that.

scop avatar May 07 '21 16:05 scop