Skip to content
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

[bug]: zsh-autocomplete creates file called $'\374'$'\227'$'\374'$'\233'$'\374' in working directory when completing [[ with long lines in history file and terminal in 256 color mode #523

Open
1 task done
raxod502 opened this issue May 22, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@raxod502
Copy link

What happened?

Exactly what it says in the title.

Yes, I know this sounds insane. Because of that I have produced a ready to execute Dockerfile that reproduces the issue, see below. If I get rid of any of the requirements mentioned in the issue title, the problem no longer occurs.

Reporting the bug here because per the maintainer of zsh-autocomplete, this is the fault of zinit: marlonrichert/zsh-autocomplete#588 (comment)

Steps to reproduce

Build and run the following Dockerfile:

FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y zsh
RUN apt-get install -y curl
RUN apt-get install -y git
RUN chsh -s /usr/bin/zsh
CMD ["zsh"]
RUN git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit
RUN curl https://gist.githubusercontent.com/raxod502/2952e2370f11fe2ff8dc69b7b728de8a/raw/607f386c9a7649d393663f3032837308cb971ddb/wtf.txt > /root/.zsh_history
RUN echo 'source ~/.zinit/zinit.zsh' >> ~/.zshrc
RUN echo 'zinit light marlonrichert/zsh-autocomplete' >> ~/.zshrc
RUN echo 'HISTFILE=~/.zsh_history' >> ~/.zshrc
WORKDIR /opt

E.g., docker build . -t bug && docker run -it --rm bug.

Then, perform the following steps:

wit% sudo docker run -it --rm bug 

Downloading marlonrichert/zsh-autocomplete...
Cloning into '/root/.zinit/plugins/marlonrichert---zsh-autocomplete'...
⠸ █████████████████████████ OBJ: 100, PACK: 4013/4013, COMPR: 100%, REC: 100%, RES: 100%          
==> Compiling zsh-autocomplete.plugin.zsh [OK]
==> Installed 8 completions
cdb4ff385b90# env -i TERM=xterm-256color zsh
cdb4ff385b90# ls -lA
total 0
cdb4ff385b90# [[
cdb4ff385b90# ls -lA
total 0
-rw-r--r-- 1 root root 0 May 13 03:34 ''$'\374\227\374\233\374'

In the step where I type [[, I include a space after the [[ and then press ^C to abort the command. Deleting the typed characters also works. The point is to trigger autocompletions for [[. Observe that a file called $'\374'$'\227'$'\374'$'\233'$'\374' has somehow appeared in the working directory, which was previously empty.

Just to make sure this wasn't a problem with the terminal emulator on my machine, I signed up for a free account on Google Cloud Shell and ran the same test case there, with the same result:

image

Relevant output

No response

Screenshots and recordings

image

Operating System & Version

OS: linux-gnu | Vendor: ubuntu | Machine: x86_64 | CPU: x86_64 | Processor: x86_64 | Hardware: x86_64

Zsh version

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Terminal emulator

xterm-256color

If using WSL on Windows, which version of WSL

None

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@raxod502 raxod502 added the bug Something isn't working label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants