-
Notifications
You must be signed in to change notification settings - Fork 178
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
mcfly 0.9.2 conflict with zoxide in WarpTerminal #435
Comments
I'll take a look. |
I made a PR that reverts the change, and it works as expected. The proposed change for using arrays needs more testing in my opinion. |
I don't use WarpTerminal, but the problem doesn't reproduce in my environment with several other terminals. In addition, I don't have an idea about the reason why the change in #430 would cause the reported behavior. What I can tell from the content of
I suspect some settings in your environment performs I first suspected WarpTerminal's shell integration (if any). WarpTerminal seems to be closed-source, so I don't have a way to quickly check (without installing WarpTerminal) whether WarpTerminal has a shell integration and, if any, whether it is related to the present problem. They seem to declare that they will gradually make the codebase open-source (see warpdotdev/Warp#400 and warpdotdev/Warp@876cca9), but there seems to be no progress after two years. @aminya I have questions:
$ declare -p PROMPT_COMMAND
PROMPT_COMMAND=('(echo foo)' '(echo bar)') |
|
No, I could not reproduce it in KDE Konsole.
The output with only zoxide and mcfly in Warp declare -p PROMPT_COMMAND
declare -- PROMPT_COMMAND="__zoxide_hook;;mcfly_prompt_command
__bp_trap_string=\"\$(trap -p DEBUG)\"
trap - DEBUG
__bp_install" The output with only zoxide and mcfly in KDE Console: > declare -p PROMPT_COMMAND
declare -a PROMPT_COMMAND=([0]="__zoxide_hook;" [1]="mcfly_prompt_command") The above shows that the check for the array doesn't seem to be enough. Warp, uses a more complex entry in its
Yes
Yes, I tested with only those two lines, and the issue happened to me. |
Thank you for the information! From the answers to Q1, Q4, and Q2 for KDE Konsole, it seems Warp Terminal is at least related. I'm currently trying to install it in my Arch (I'm not sure, but Warp Terminal hangs with the startup window of "Sign up" in my environment). While I attempt the installation, could you also check the behavior with the following setting?
# bashrc
PROMPT_COMMAND=('(echo foo);' '(echo bar)') edit:
|
Although the suffix When
|
Here's the output with the above in bashrc. I face the same error. I don't get foo/bar bash: PROMPT_COMMAND: line 706: syntax error near unexpected token `;;'
bash: PROMPT_COMMAND: line 706: `(echo foo);;(echo bar)' > declare -p PROMPT_COMMAND
declare -- PROMPT_COMMAND="(echo foo);;(echo bar)
__bp_trap_string=\"\$(trap -p DEBUG)\"
trap - DEBUG
__bp_install" |
Thank you! Then, I'll have to conclude that this is a bug of Warp Terminal (or a shell setting loaded by Warp Terminal). Although I still cannot launch the Warp Terminal in my environment (probably because of some X11 Forwarding issue with the SSH connection), but I could extract the Bash integration script from the $ strings /path/to/warp | sed -n '/# We need to prepend a space/,/^ *warp_bootstrapped/p' > warp.bash This script has 1307 lines, but I'll examine suspicious parts related to |
I found the following section starting on line 1211 of the Warp shell integration script: # If the user's rc files turned PROMPT_COMMAND into an array, we must undo that.
# Since Bash 5.1, the PROMPT_COMMAND variable can be an array, see:
# https://tiswww.case.edu/php/chet/bash/NEWS
# Unfortunately, doing so will break Warp because of the way it interacts with bash-preexec.
# When PROMPT_COMMAND is an array, the DEBUG signal fires for each array element, and since
# bash-preexec uses a DEBUG trap to trigger the preexec functions, it will run our preexec
# functions before the command at PROMPT_COMMAND[1], PROMPT_COMMAND[2], etc. This means our
# Preexec hook gets called without the user submitting a command, putting the input block into
# a broken state, e.g. see https://github.com/warpdotdev/Warp/issues/2636
# If they end up fixing this, we may be able to remove this at some point, check this:
# https://github.com/rcaloras/bash-preexec/issues/130
#
# If PROMPT_COMMAND is set and it's an array, "join" the array into a semicolon-delimited string,
# then overwrite PROMPT_COMMAND
if [[ -n $PROMPT_COMMAND && "$(declare -p PROMPT_COMMAND)" =~ "declare -a" ]]; then
PROMPT_COMMAND_FLATTENED=$(IFS="; "; echo "${PROMPT_COMMAND[*]}")
unset PROMPT_COMMAND
PROMPT_COMMAND=$PROMPT_COMMAND_FLATTENED
fi I have to say the line I searched for the first line of the extracted script on the internet and in the GitHub code search, but nothing was found. This means that the Bash ingtegration script of Warp is indeed closed-source, yet we may ask the upstream Warp project about this issue. |
@aminya For the time being, could you put the following line at the end of PROMPT_COMMAND=("${PROMPT_COMMAND[@]%;}") |
I just upgraded mcfly to 0.9.2, but when zoxide is enabled, the bash prompt doesn't work anymore.
Here's the error I get when I open a new shell
.bashrc
This seems to be happening only in Warp. I can't reproduce it using KDE Konsole.
This looks like the faulty commit:
b8e86c5
#430
The text was updated successfully, but these errors were encountered: