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
This is a follow-up to #40. I'm opening a new issue because the older one has been closed and i've been able to come up with a reproducer.
How to reproduce
Build the following docker file docker build -t compal:gh46 .
Dockerfile
# syntax=docker/dockerfile:1.4FROM debian:bookworm-slim
RUN <<EOS
set -ex
apt update && apt install -y --no-install-recommends \
bash-completion \
ca-certificates \
curl \
git
adduser test
EOS
USER test
WORKDIR /home/test
RUN bash <<'EOS'
set -ex
git clone --depth=1 https://github.com/cykerway/complete-alias.git compal
git clone --depth=1 https://github.com/junegunn/fzf.git .fzf
./.fzf/install
EOS
COPY <<'EOF' ./.bash_aliases
alias ls="ls --color=auto"
EOF
COPY <<'EOF' ./.bash_completion
source ~/compal/complete_alias
complete -F _complete_alias "${!BASH_ALIASES[@]}"
EOF
Run a bash session in a container:
docker run -it --rm compal:gh46 bash
On the bash prompt, type ls -<TAB>.
The shell enters an infinite loop, reapetedly outputing error: cannot unmask alias command: ls.
Type <Ctrl-C> until you can go back to the prompt and exit.
How to fix
Running docker run -it --rm compal:gh46 tail .bashrc outputs:
We can see that the fzf installation script has blindly appended it's source command. The result is that the fzf completion script is sourced after ~./bash_completion (since the latter is itself sourced at the end of /usr/share/bash-completion/bash_completion).
If we instead use the following dockerfile:
Dockerfile
# syntax=docker/dockerfile:1.4FROM debian:bookworm-slim
RUN <<EOS
set -ex
apt update && apt install -y --no-install-recommends \
bash-completion \
ca-certificates \
curl \
git
adduser test
EOS
USER test
WORKDIR /home/test
RUN bash <<'EOS'
set -ex
git clone --depth=1 https://github.com/cykerway/complete-alias.git compal
git clone --depth=1 https://github.com/junegunn/fzf.git .fzf
./.fzf/install --no-update-rc
EOS
COPY <<'EOF' ./.bash_aliases
alias ls="ls --color=auto"
EOF
COPY <<'EOF' ./.bash_completion
source ~/.fzf.bash
source ~/compal/complete_alias
complete -F _complete_alias "${!BASH_ALIASES[@]}"
EOF
Then typing ls -<TAB><TAB><TAB> correctly shows the ls option completions, but typing ls /etc/**<TAB> does not show the fzf path completions.
If we now export COMPAL_AUTO_UNMASK=1 at the top of ~/.bash_completion, then typing ls -<TAB><TAB><TAB> correctly shows the ls option completions, and typing ls /etc/**<TAB> correctly shows the fzf path completions.
Final notes
I do not have the knowledge required to find tha actual cause of the issue, nor to tell if it's a bug in complete-alias, fzf, bash itself or just a fundamental limitation of the bash completion system...
However I think that this might warrant an entry in the docs stating that care should be taken that, in presence of other completion handlers, complete_alias should be sourced last, and that the COMPAL_AUTO_UNMASK setting may resolve some conflicts.
The text was updated successfully, but these errors were encountered:
Hi,
This is a follow-up to #40. I'm opening a new issue because the older one has been closed and i've been able to come up with a reproducer.
How to reproduce
Build the following docker file
docker build -t compal:gh46 .
Dockerfile
Run a bash session in a container:
On the bash prompt, type
ls -<TAB>
.The shell enters an infinite loop, reapetedly outputing
error: cannot unmask alias command: ls
.Type
<Ctrl-C>
until you can go back to the prompt and exit.How to fix
Running
docker run -it --rm compal:gh46 tail .bashrc
outputs:We can see that the
fzf
installation script has blindly appended it's source command. The result is that the fzf completion script is sourced after~./bash_completion
(since the latter is itself sourced at the end of/usr/share/bash-completion/bash_completion
).If we instead use the following dockerfile:
Dockerfile
Then typing
ls -<TAB><TAB><TAB>
correctly shows the ls option completions, but typingls /etc/**<TAB>
does not show the fzf path completions.If we now
export COMPAL_AUTO_UNMASK=1
at the top of~/.bash_completion
, then typingls -<TAB><TAB><TAB>
correctly shows the ls option completions, and typingls /etc/**<TAB>
correctly shows the fzf path completions.Final notes
I do not have the knowledge required to find tha actual cause of the issue, nor to tell if it's a bug in
complete-alias
,fzf
,bash
itself or just a fundamental limitation of the bash completion system...However I think that this might warrant an entry in the docs stating that care should be taken that, in presence of other completion handlers,
complete_alias
should be sourced last, and that theCOMPAL_AUTO_UNMASK
setting may resolve some conflicts.The text was updated successfully, but these errors were encountered: