Open matthiasbeyer opened 5 months ago
I'm not sure what is happening there either. At least, I've never hit this behavior in my environment.
I think this is related to completions because compgen
is a Bash builtin command that is used for programmable completions. So the first thing to check is whether it is caused inside auto-complete
(i.e., the autosuggestion feature of ble.sh).
auto-complete
by the following command?$ bleopt complete_auto_complete=
$ ble/widget/display-shell-version
I have also other questions, but I'll ask them after checking an answer to Q1.
I've found something similar at https://github.com/NixOS/nixpkgs/issues/157882, though it seems to be reported against Zsh.
$ complete -p git
$ type compgen
~/debug.txt
is created? If it is created, could you provide its content? After the test, you can delete the file ~/debug.txt
.$ ble/function#advice before git 'echo "${ADVICE_WORDS[@]}" >> ~/debug.txt'
$ git annex .... # <-- here, please input something and try to reproduce the error messages
SHELL
?$ echo "$SHELL"
SHELL
is not Bash, when SHELL is set to a path to Bash, does the issue reproduce?$ export SHELL=$BASH
$ git annex .l.. # <-- see if the error messages appear
SHELL
. I'm asking for the login shell associated with your user account in the system. ]$ getent passwd | awk -F : -v UID="$UID" '$3==UID {print $7}'
auto-complete
, with that setting, does the TAB completion produce a similar error message?$ bleopt complete_auto_complete=
$ git annex ... [press TAB here]
$ ble/function#push enable true
$ git annex ... # <-- see if the error messages reproduce
This seems to be related: https://github.com/dhall-lang/dhall-haskell/issues/2362
Hmm, the discussion there reminds me of another discussion started at https://github.com/akinomyoga/ble.sh/issues/169#issuecomment-1029598071.
$ echo "$BASH"
$ readlink /proc/$$/exe
BASH
in this way?$ BASH=$(readlink /proc/$$/exe)
$ git annex ... # <-- does the problem reproduce here?
$ type -a bash
Fun thing is: I cannot reproduce the issue right now, so I cannot answer all your questions right now... I'll answer everything else as good as I can:
Q1: Does the behavior persist after disabling auto-complete by the following command?
bleopt complete_auto_complete=
Cannot answer right now, because I cannot reproduce.
Q2: Also, could you provide the results of the following command?
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) [NixOS 23.11 (Tapir)]
ble.sh, version 0.4.0-devel3+1a5c451c (noarch) [git 2.39.0, GNU Make 4.3, GNU Awk 5.1.1, API: 3.1 (GNU MPFR 4.1.0-p13, GNU MP 6.2.1)]
bash-completion, version 2.11 (hash:19e2694965e22296373454c974d11a309db1e89c, 76396 bytes) (noarch)
fzf key-bindings, (hash:66601b132b32248c0b47926f99fd02832ba06892, 5577 bytes) (noarch)
WARNING: fzf integration "integration/fzf-key-bindings" is not activated.
fzf completion, (hash:db84e06a1ee5fb43bc6ad1aaeec6657cad79c917, 14523 bytes) (noarch)
WARNING: fzf integration "integration/fzf-completion" is not activated.
starship, version 1.17.1 (rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball), 1980-01-01 00:00:00 +00:00)
locale: LANG=de_DE.UTF-8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.0-2+ri, konsole:220380 (1;115;0)
Q3: What are the results of the following commands?
$ complete -p git
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git
$ type compgen
compgen is a shell builtin
Q4: Could you run the following command, reproduce the error messages, and see if a file ~/debug.txt is created? If it is created, could you provide its content? After the test, you can delete the file ~/debug.txt.
$ ble/function#advice before git 'echo "${ADVICE_WORDS[@]}" >> ~/debug.txt'
$ git annex .... # <-- here, please input something and try to reproduce the error messages
Cannot answer right now, because I cannot reproduce.
Q5: What is the value of SHELL?
/var/run/current-system/sw/bin/bash
Q5a: If the value of SHELL is not Bash, when SHELL is set to a path to Bash, does the issue reproduce?
Not applicable, $SHELL == $BASH
Q6: What is your login shell?
$ getent passwd | awk -F : -v UID="$UID" '$3==UID {print $7}'
/var/run/current-system/sw/bin/bash
Q6a: If your login shell is not Bash, could you temporarily change the login shell to Bash to see if the problem still reproduces? After checking, you can revert the login shell.
Not applicable, login shell is bash.
Fun thing is: I cannot reproduce the issue right now, so I cannot answer all your questions right now... I'll answer everything else as good as I can:
I see. Thank you for all your answers. If this issue is related to https://github.com/dhall-lang/dhall-haskell/issues/2362 or https://github.com/akinomyoga/ble.sh/issues/169#issuecomment-1029598071 mentioned above, maybe the problem only arises in nix-shell
, nix shell
, or nix develop
.
@matthiasbeyer Have you faced the same problem after that?
Yes, and it seems to be a nix shell
issue indeed.
Thank you for the information. I'm wondering what would be the solution for this issue.
I here assume that the root cause is the same as the problem mentioned in https://github.com/akinomyoga/ble.sh/issues/169#issuecomment-1029598071. If that is the case, as I mentioned there, I'd like to request nix shell
to stop overwriting the shell variable BASH
with something like a dumb version of Bash if possible. What do you think?
If there is a strong reason that the current behavior of nix shell cannot be changed, I might need to think about a workaround. In that case, could you check the results of Q8, Q8a, and Q9 inside nix shell
environment (where the problem reproduces)?
I finally came around to answer the questions you mentioned:
Q8:
$ echo "$BASH"
/nix/store/x88ivkf7rmrhd5x3cvyv5vh3zqqdnhsk-bash-interactive-5.2-p15/bin/bash
$ readlink /proc/$$/exe
/nix/store/x88ivkf7rmrhd5x3cvyv5vh3zqqdnhsk-bash-interactive-5.2-p15/bin/bash
Q8a: not applicable
Q9:
$ type -a bash
bash ist /nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash
bash ist /run/current-system/sw/bin/bash
Thanks!
nix shell
?$ type compgen
$ "$BASH" -c 'type compgen'
$ "$BASH" -c 'comgpen -W "test{1..3}"'
$ bash -c 'type compgen'
$ bash -c 'compgen -W "test{1..3}"'
$ /run/current-system/sw/bin/bash -c 'type compgen'
$ /run/current-system/sw/bin/bash -c 'compgen -W "test{1..3}"'
Here we go (sorry for the german locale :laughing: ):
$ type compgen
compgen ist eine von der Shell mitgelieferte Funktion.
$ "$BASH" -c 'type compgen'
compgen ist eine von der Shell mitgelieferte Funktion.
$ "$BASH" -c 'comgpen -W "test{1..3}"'
/nix/store/x88ivkf7rmrhd5x3cvyv5vh3zqqdnhsk-bash-interactive-5.2-p15/bin/bash: Zeile 1: comgpen: Kommando nicht gefunden.
[ble: exit 127]
$ bash -c 'type compgen'
bash: line 1: type: compgen: not found
[ble: exit 1]
$ bash -c 'compgen -W "test{1..3}"'
bash: line 1: compgen: command not found
[ble: exit 127]
$ /run/current-system/sw/bin/bash -c 'type compgen'
compgen ist eine von der Shell mitgelieferte Funktion.
$ /run/current-system/sw/bin/bash -c 'compgen -W "test{1..3}"'
test1
test2
test3
Thanks. Hmm, it seems the error message is produced by another process called as bash
(which points to /nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash
). Since ble.sh
doesn't call the command bash
, the error message might be produced in a third-party setting for some completion settings.
ble.sh
?$ ble-detach $ stty sane; $ git annex copy [TAB]
Could you press TAB in the above position marked as [TAB]
? ([TAB]
is not the string to input) Here, git annex copy
would be a string that causes the error message of "compgen not found" in ble.sh's session.
yes, it is indeed reproducible... :thinking: :eyes:
Thanks! Then, I guess it's unrelated to ble.sh.
~/.bashrc
and see if the problem reproduces with git annex copy
[TAB]?nix shell
without ble.sh?$ exec {BASH_XTRACEFD}> debug.txt
$ set -x
$ git annex copy bash [TAB]
$ set +x
Then, could you share the content of debug.txt? You can attach a text file by dropping the file in GitHub's textbox.
ble version: 0.4.0-devel3+1a5c451c Bash version: 5.2.15(1)-release (x86_64-pc-linux-gnu)
I am not 100% positive that this is actually an issue with blesh, but it never happened before I installed blesh, so this is where I think posting this issue is the best way to start:
The error you see happened while typing, no
TAB
was hit or something like that, just simple typing. I am not sure what to do to debug this, though.