Open phil-markarian opened 5 months ago
Does the problem only happen when ble.sh is enabled?
What are the outputs of the following commands?
$ alias -p
$ ls -l /tmp/alias_completion-*
Yeah, it only happens when ble.sh is enabled.
Here are my outputs:
{ home } alias -p
alias -- -='cd -'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias _='sudo'
alias aptinst='apt-get install -V'
alias aptpurge='apt-get remove --purge'
alias aptrm='apt-get remove'
alias apts='apt-cache search'
alias aptshow='apt-cache show'
alias aptupd='apt-get update'
alias aptupg='apt-get dist-upgrade -V && sudo apt-get autoremove'
alias aptupgd='apt-get update && sudo apt-get dist-upgrade -V && sudo apt-get autoremove'
alias babsh='bash-it'
alias bash_it='bash-it'
alias bash_ti='bash-it'
alias bashconf='nvim ~/.bashrc'
alias bashit='bash-it'
alias batbsh='bash-it'
alias batshit='bash-it'
alias bshena='bash-it enable alias'
alias bshenc='bash-it enable completion'
alias bshenp='bash-it enable plugin'
alias bshha='bash-it help aliases'
alias bshhc='bash-it help completions'
alias bshhp='bash-it help plugins'
alias bshsa='bash-it show aliases'
alias bshsc='bash-it show completions'
alias bshsch='bash-it search'
alias bshsp='bash-it show plugins'
alias c='clear'
alias cd..='cd ..'
alias chkboot='cat /var/run/reboot-required'
alias chkup='/usr/lib/update-notifier/apt-check -p --human-readable'
alias cls='clear'
alias dco='docker-compose'
alias dcofresh='docker-compose-fresh'
alias dcol='docker-compose logs -f --tail 100'
alias dcou='docker-compose up'
alias dcouns='dcou --no-start'
alias dk='docker'
alias dkbash='dkelc'
alias dkelc='docker exec -it $(dklcid) bash --login'
alias dkex='docker exec -it '
alias dki='docker images'
alias dkideps='docker-image-dependencies'
alias dkip='docker image prune -a -f'
alias dklc='docker ps -l'
alias dklcid='docker ps -l -q'
alias dklcip='docker inspect -f "{{.NetworkSettings.IPAddress}}" $(docker ps -l -q)'
alias dkps='docker ps'
alias dkpsa='docker ps -a'
alias dkre='docker-runtime-environment'
alias dkri='docker run --rm -i '
alias dkric='docker run --rm -i -v $PWD:/cwd -w /cwd '
alias dkrit='docker run --rm -it '
alias dkritc='docker run --rm -it -v $PWD:/cwd -w /cwd '
alias dkrmac='docker rm $(docker ps -a -q)'
alias dkrmall='docker-remove-stale-assets'
alias dkrmflast='docker rm -f $(dklcid)'
alias dkrmi='docker-remove-images'
alias dkrmlc='docker-remove-most-recent-container'
alias dkrmli='docker-remove-most-recent-image'
alias dkrmui='docker images -q -f dangling=true | xargs -r docker rmi'
alias dksp='docker system prune -a -f'
alias dkvp='docker volume prune -f'
alias edit='${EDITOR:-${ALTERNATE_EDITOR:-nano}}'
alias h='history'
alias ipy='ipython'
alias irc='${IRC_CLIENT:=irc}'
alias l='ls -a'
alias l1='ls -1'
alias la='ls -AF'
alias lf='ls -F'
alias ll='ls -al'
alias ls='ls --color=auto'
alias md='mkdir -p'
alias nv='nvim'
alias pager='${PAGER:=less}'
alias pass='passgen'
alias piano='pianobar'
alias pkgfiles='dpkg --listfiles'
alias py='python'
alias q='exit'
alias rb='ruby'
alias rd='rmdir'
alias reload_aliases='source '\''/root/.bash_it/scripts/reloader.bash'\'' '\''alias'\'' '\''aliases'\'''
alias reload_completion='source '\''/root/.bash_it/scripts/reloader.bash'\'' '\''completion'\'' '\''completion'\'''
alias reload_plugins='source '\''/root/.bash_it/scripts/reloader.bash'\'' '\''plugin'\'' '\''plugins'\'''
alias shit='bash-it'
alias sl='ls'
alias sourceme='source ~/.bashrc'
alias vbpf='${VISUAL:-vim} ~/.bash_profile'
alias vbrc='${VISUAL:-vim} ~/.bashrc'
alias xt='extract'
root on Tuesday at 9:47 PM 0.035s MEM: 19.57% (4/8GB)
{ home } ls -l /tmp/alias_completion-*
-rw------- 1 root root 55028 Jun 11 11:29 /tmp/alias_completion-10570esqXFv
-rw------- 1 root root 55028 Jun 11 12:38 /tmp/alias_completion-11493Ehdlsu
-rw------- 1 root root 55195 Jun 11 17:47 /tmp/alias_completion-1561GEWrR5
-rw------- 1 root root 30301 Jun 11 09:07 /tmp/alias_completion-17005XV1NtE
-rw------- 1 root root 30277 Jun 11 01:45 /tmp/alias_completion-17153n8ZEZf
-rw------- 1 root root 55028 Jun 11 10:56 /tmp/alias_completion-17581A88T4D
-rw------- 1 root root 55028 Jun 11 10:57 /tmp/alias_completion-17658DSJbnP
-rw------- 1 root root 55028 Jun 11 10:48 /tmp/alias_completion-18184p0DUXk
-rw------- 1 root root 30277 Jun 11 01:49 /tmp/alias_completion-19156vbnEv5
-rw------- 1 root root 30277 Jun 11 01:46 /tmp/alias_completion-19645MrbVC2
-rw------- 1 root root 30285 Jun 11 01:26 /tmp/alias_completion-22757jQ0sof
-rw------- 1 root root 55195 Jun 11 17:48 /tmp/alias_completion-23769qilp1o
-rw------- 1 root root 55028 Jun 11 12:54 /tmp/alias_completion-25114jdRhHK
-rw------- 1 root root 55028 Jun 11 11:28 /tmp/alias_completion-26183Oh4p41
-rw------- 1 root root 55028 Jun 11 12:54 /tmp/alias_completion-26950Z3G6iL
-rw------- 1 root root 55028 Jun 11 11:22 /tmp/alias_completion-2812dReNIN
-rw------- 1 root root 55028 Jun 11 11:19 /tmp/alias_completion-30083FsrPwh
-rw------- 1 root root 55028 Jun 11 11:26 /tmp/alias_completion-3313JJOO4J
-rw------- 1 root root 55028 Jun 11 11:04 /tmp/alias_completion-37394nH2tf
-rw------- 1 root root 30285 Jun 11 01:32 /tmp/alias_completion-40951Rc1Km
-rw------- 1 root root 30277 Jun 11 01:44 /tmp/alias_completion-4852oxiw2E
-rw------- 1 root root 30285 Jun 11 01:24 /tmp/alias_completion-5107wXIogD
-rw------- 1 root root 55028 Jun 11 11:26 /tmp/alias_completion-5902Ev29qU
-rw------- 1 root root 55028 Jun 11 15:26 /tmp/alias_completion-6036UQF9hR
-rw------- 1 root root 28249 Jun 11 01:43 /tmp/alias_completion-735AEMpmp
-rw------- 1 root root 55028 Jun 11 12:41 /tmp/alias_completion-7789yY101a
-rw------- 1 root root 55195 Jun 11 16:25 /tmp/alias_completion-856rJWVkL
-rw------- 1 root root 55028 Jun 11 11:18 /tmp/alias_completion-9647dFWCfl
Thanks. What is the result of the following command?
$ ble/widget/display-shell-version
The temporary files seem to remain, so I think it would be easier to look into that. Could you attach the file /tmp/alias_completion-23769qilp1o
here? You can copy the file to alias_completion-23769qilp1o.txt
(with the filename extension .txt
added) and drag & drop the file into the textarea of the GitHub interface.
Note: there seem to be many other similar files, but please make sure to choose 23769qilp1o
because the other files might not have caused the problem.
Here is the output:
ble.sh, version 0.4.0-devel4+365101cf (noarch) [git 2.39.2, GNU Make 4.3, GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0, GNU MP 6.2.1)]
bash-completion, version 2.11 (hash:aefcfdd4b924e8b03db0d49be8bdb5881ad7d0cd, 77084 bytes) (noarch)
bash-preexec, (hash:5f1208c33e624859eea70e3843bd9b8c9a06819e, 13046 bytes) (noarch)
bash-it, version +d985e4c9 (noarch), alias(apt docker docker-compose general), completion(aliases bash-it system), plugin(base blesh docker-compose docker explain fzf git history-eternal thefuck)
locale: LANG=en_US.UTF-8
terminal: TERM=xterm-256color wcwidth=12.1-west/15.1-2+ri, xterm:276 (0;276;0)
Here is the contents for /tmp/alias_completion-23769qilp1o
What do you mean by choosing exactly? I thought that these files are autogeneriated when using any of the build in aliases.
Thanks. I'll take a look.
What do you mean by choosing exactly?
Your ls
result shows many temporary files /tmp/alias_completion-XXXXXXXXXXX
where the part XXXXXXXXXXX
are randomly generated. The sizes of those files seem to be different, so the file contents are different. I wanted the content of the file with XXXXXXXXXXX being exactly 23769qilp1o because that is the one you reported in your first post.
I thought that these files are autogeneriated when using any of the build in aliases.
Yes. I guess they would probably cause the same issue, but I can't say they cause the present problem 100%. Also the hint for the line number 978
in your first report cannot be applied to other files.
Thanks. I'll take a look.
Thanks.
I wanted the content of the file with XXXXXXXXXXX being exactly 23769qilp1o because that is the one you reported in your first post.
Ah, I get what you were saying now. Had a brain fart lol.
This is an issue of the aliases
completion module. The following line is causing the problem:
The variables $alias_cmd
and $alias_args
may contain an arbitrary string, but they are not properly quoted in generating the body of the dynamically defined function.
I'm not sure if it will be fixed in Bash-it because I don't see the activity of the Bash-it maintainers recent years. At least, I guess it would take months to have it fixed. If you don't use aliases
module, you can disable the module by running the following command.
$ bash-it disable completion aliases
Thanks for looking at it for me.
The variables $alias_cmd and $alias_args may contain an arbitrary string, but they are not properly quoted in generating the body of the dynamically defined function.
Hmm,I see.
I'm not sure if it will be fixed in Bash-it because I don't see the activity of the Bash-it maintainers recent years. At least, I guess it would take months to have it fixed.
I don't mind fixing a bug myself, but the bash-it system is kind of complex and I am not very well versed in bash yet. I'll give a crack at it and see if I can get something to work though. It doesn't really impact my productivity but it stands out haha.
Used Claude and ChatGPT to help me get close to fixing the issue.
The issue was making sure that the single quote is escaped properly. The code below fixes the error that occurs, but this code is buggy because when I tried to type say something like ls /tmp/
it will gave a bunch of strange suggestions for some reason. Anyway, I'll add updates as I go along.
echo "function $compl_wrapper {
local compl_word=\${2?}
local prec_word=\${3?}
# check if prec_word is the alias itself. if so, replace it
# with the last word in the unaliased form, i.e.,
# alias_cmd + ' ' + alias_args.
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
prec_word='${alias_cmd} ${alias_args//\'/\'\\\\\'\'}'
prec_word=\${prec_word#* }
fi
(( COMP_CWORD += ${#alias_arg_words[@]} ))
COMP_WORDS=(\"\${alias_cmd}\" \"\${alias_arg_words[@]//\'/\'\\\\\'\'}\" \"\${COMP_WORDS[@]:1}\")
(( COMP_POINT -= \${#COMP_LINE} ))
COMP_LINE=\${COMP_LINE//$alias_name/\${alias_cmd} \${alias_args//\'/\'\\\\\'\'}}
(( COMP_POINT += \${#COMP_LINE} ))
\"\${compl_func}\" \"\${alias_cmd}\" \"\$compl_word\" \"\$prec_word\"
}" >> "$tmp_file"
Expected behavior
source .bashrc doesn't work without errors.
Current behavior
Currently when I do source .bashrc it gives me the following error,
bash: /tmp/alias_completion-23769qilp1o: line 978: unexpected EOF while looking for matching
''`Possible solution
No response
Context
I have a fresh install plus I have ble.sh plugin turned on and ble.sh installed.
Steps to reproduce
Install bash-it with --silent flag. Install ble.sh and then enable add-on. Do source .bashrc.
Bash-it version
d985e4c
List of enabled plugins, themes and aliases
base, oh-my-posh
Bash version
5.2.15
Operating system and version
Debian GNU/Linux 12
bash-it doctor output
Your ~/.bashrc
Notes
No response