You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @romkatv and team, I've been using your fantastic z4h project for a while and I wanted to thank you for the fantastic product. For many months I've had no issues but something weird now happens every once in a while. I was curious if you have ideas about how to I should debug this intermittent message:
^[[>0;10;1c(anon):43: bad math expression: operand expected at `>0'snshah@wsllocal / % z4h recovery mode
I'm running on Debian 11 WSL2 VM in Windows 11 and many times a day when I open a terminal I get the message above. I'm using a "stock" z4h setup and when I run z4h update the error message goes away. Then, when I open a new terminal sometimes I do not get the message but other times I do see the message. Anytime I do see the message, running z4h update in that terminal will fix everything but then, later, when I open a new terminal sometimes the problem reappears.
I figured that since z4h has gone into recovery mode perhaps there's some debugging I can do to figure out which file (anon):43 refers to. There are times when no messages appear and all is good but then there are times when the exact same message as above appears on the same (anon):43.
I have not figured out how to reproduce the problem so this ticket is really mostly a request for ideas about how to do debugging. :-)
This is a third report I'm getting about something being broken in a severe and weird way on Windows 11. Your report is the first with this error.
Does exec zsh fix your shell when the error happens? Hopefully it can at least serve as a workaround until I figure out what's going on.
Can you try adding setopt xtrace at the top of ~/.zshrc and invoke unsetopt xtrace after z4h init? Like this:
diff --git a/.zshrc b/.zshrc
index 54480ae..5ae5b94 100644
--- a/.zshrc+++ b/.zshrc@@ -1,3 +1,5 @@+setopt xtrace+
# Personal Zsh configuration file. It is strongly recommended to keep all
# shell customization and configuration (including exported environment
# variables such as PATH) in this file or in files source by it.
@@ -50,7 +52,11 @@ z4h install ohmyzsh/ohmyzsh || return
# initialize Zsh. After this point console I/O is unavailable until Zsh
# is fully initialized. Everything that requires user interaction or can
# perform network I/O must be done above. Everything else is best done below.
-z4h init || return+{+ z4h init || return+} always {+ unsetopt xtrace+}
# Extend PATH.
path=(~/bin $path)
With this change your terminal will produce a lot of output when you start it. If you can catch the bug with it, please post as much of the output from the end as you can.
Thanks for the quick reply, @romkatv - yes, running exec zsh does fix it (as does z4h update). I will do the tracing you mentioned above and get back to you with what I discover. Perhaps my pain can help others! :-)
Thanks for the info. It's valuable. You can turn off xtrace. I'll get back to you once I have a fix or a question. Use exec zsh as a workaround until then.
Your terminal takes a very long time to reply to secondary DA request (\033[>c). After one second tmux gives up and marks the terminal as not having any features. Eventually the response to the request arrives (\033[>0;10;1c) and tmux lets it pass through to the client because it's not expending this response anymore.
A proper fix would be to figure out why your terminal takes so long to reply and fix it. Maybe it's one of those Windows 11 things. I'll also implement a workaround in z4h so that shell doesn't break when the terminal is in a sorry state like this.
Activity
romkatv commentedon Nov 22, 2021
This is a third report I'm getting about something being broken in a severe and weird way on Windows 11. Your report is the first with this error.
Does
exec zshfix your shell when the error happens? Hopefully it can at least serve as a workaround until I figure out what's going on.Can you try adding
setopt xtraceat the top of~/.zshrcand invokeunsetopt xtraceafterz4h init? Like this:With this change your terminal will produce a lot of output when you start it. If you can catch the bug with it, please post as much of the output from the end as you can.
shah commentedon Nov 22, 2021
Thanks for the quick reply, @romkatv - yes, running
exec zshdoes fix it (as doesz4h update). I will do the tracing you mentioned above and get back to you with what I discover. Perhaps my pain can help others! :-)shah commentedon Nov 22, 2021
@romkatv here's what I see when I turn on xtrace as you suggested:
I'm using Debian 11 on WSL2 on Windows 11 on an AMD64 5700G CPU. But the same happens on other CPUs as well. Thanks for checking into this!
When the error above occurs and I run
exec zshall is well again.Seems to be related to it being a login shell vs. a regular shell.?
romkatv commentedon Nov 22, 2021
Thanks for the info. It's valuable. You can turn off
xtrace. I'll get back to you once I have a fix or a question. Useexec zshas a workaround until then.romkatv commentedon Nov 22, 2021
I think I've figured out what's going on.
Your terminal takes a very long time to reply to secondary DA request (
\033[>c). After one second tmux gives up and marks the terminal as not having any features. Eventually the response to the request arrives (\033[>0;10;1c) and tmux lets it pass through to the client because it's not expending this response anymore.A proper fix would be to figure out why your terminal takes so long to reply and fix it. Maybe it's one of those Windows 11 things. I'll also implement a workaround in z4h so that shell doesn't break when the terminal is in a sorry state like this.
survive random junk coming out of a TTY when starting up
romkatv commentedon Nov 22, 2021
This is done. You can pick up the fix with
z4h update.shah commentedon Nov 22, 2021
Looks great so far @romkatv!
romkatv commentedon Nov 22, 2021
Thanks for verifying. Closing. I've opened an issue with the upstream: tmux/tmux#2984