Open galderz opened 1 year ago
After enabling trace logging, I am seeing that executing this command hangs qDup on machines that are not using bash/sh for the terminal: https://github.com/Hyperfoil/qDup/blob/master/src/main/java/io/hyperfoil/tools/qdup/SshSession.java#L618
On a target machine using bash, the response buffer content from the remote machine returns are something like: ^.........[?2004h[user@localhost..]$.
, whereas for non-bash shells, the response buffer contains ^.........[0m.[49m.[39m.[27m.[24m.[1m.[7m%.[27m.[1m.[0m.........
qDup can not decode the response from the remote machine correctly
The remote machine that caused the hang was running https://github.com/romkatv/powerlevel10k on top of zsh, using zsh also causes qDup to hang
I have had a similar issue in the past with Emacs in tramp mode and the work around there is to set a different prompt depending on the value of the TERM
environment variable.
For instance I have the following in my .zshrc
case "$TERM" in
xterm*|rxvt*|eterm*|screen*|st-256color*)
# PS1="my fancy multi-line prompt > "
;;
*)
PS1="> "
;;
esac
Which sets the prompt to >
when TERM
doens't match any of the xterm*|rxvt*|eterm*|screen*|st-256color*
.
Is there a way in qDup to set an environment variable for the ssh session? It could help as a workaround till this gets fixes.
After having a look at the code, I now understand that qDup is setting the prompt itself so the above comment is irrelevant, but I think I figured out the actual issue.
The prompt used by qDup, <_#%@_qdup_@%#_>
, is subject to expansion by default in zsh resulting in a prompt like <_#10:02_qdup_@%_>
, as %@
is being expanded to the current time of the day [1]. This results in qDup failing to find the suffix in the SuffixStream, thus waiting forever.
Disabling the expansion when zsh is detected should allow qDup to set the prompt as expected. To do so one needs to run setopt NO_PROMPT_SUBST; setopt NO_PROMPT_PERCENT; setopt NO_PROMPT_BANG;
[1] https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html#Date-and-time
I think we should change the prompt to something that does not expand by default. We picked <_#%@_qdup_@%#_>
because it stood out when scanning the run.log and because it was unlikely to occur as output from other shell interaction.
I have to admit, i don't use zsh and we have not run tests on zsh in the past but I will see if I can recreate this in a container.
@zakkak Would changing the prompt to <_#_qdup_#_>
trigger any default completion in zsh?
We still need to address the additional setopt
commands but I would like to create a release that has a functional prompt while we explore better ways to support zsh.
@zakkak Would changing the prompt to
<_#_qdup_#_>
trigger any default completion in zsh?
Hi @willr3 , it seems to not trigger any default completion/expansions (AFAIK expansions are prefixed with %
).
❯ export PS1='<_#_qdup_#_> '; set +o history; export HISTCONTROL="ignoreboth"
set: no such option: history
<_#_qdup_#_>
Note the no history
option warning though.
qDup was developed and tested against bash so there are probably several places that need to be revisited when connecting to other shells.
Is there a zsh
equivalent to disable the history for the session? We disable history to avoid polluting the users history with all the commands that run as part of the qDup execution.
Is there a
zsh
equivalent to disable the history for the session? We disable history to avoid polluting the users history with all the commands that run as part of the qDup execution.
According to man zshbuiltins
it looks like this can be achieved with fc -p
:
fc -p
pushes the current history list onto a stack and switches to a new history list. If the -a option is also specified, this history list will be automatically popped when the current function scope is exited, which is a much better solution than creating a trap function to call `fc -P' manually. If no arguments are specified, the history list is left empty, $HISTFILE is unset, and $HISTSIZE & $SAVEHIST are set to their default values. If one argument is given, $HISTFILE is set to that file‐name, $HISTSIZE & $SAVEHIST are left unchanged, and the history file is read in (if it exists) to initialize the new list. If a second argument is specified, $HISTSIZE & $SAVEHIST are instead set to the single specified numeric value. Finally, if a third argument is specified, $SAVEHIST is set to a separate value from $HISTSIZE. You are free to change these environment values for the new history list however you desire in order to manipulate the new history list.
Other times running helloworld example just hangs, e.g.
Full thread dump here.
This has been observed with both macOS and fedora clients on fedora server. Java version 17.