-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/pprof: completely unable to use dumb tty #26254
Comments
Actually, the situation is far worse than I realized. If I continue the session:
The garbage at the bottom is me typing ^C, because top10 seems to be taking forever. But if I move over to Apple Terminal then top10 runs instantly. I conclude from this that not only is pprof printing garbage to my screen, it has lost the ability to read from standard input!
|
@hyangah Are you still taking care of pprof? |
May be related to https://golang.org/cl/112436 for #14041. |
https://golang.org/cl/112436 is the biggest CL I have ever seen. |
It currently uses golang.org/x/crypto/ssh/terminal and assumes that if terminal.MakeRaw works, terminal is supported. What's the right way to detect dumb tty? Is checking TERM env var sufficient? And, what's the easiest way to create a dumb tty environment for testing? (Just setting TERM=dumb doesn't do anything for me :-() |
For many readline libraries, the environment variable
At a quick glance, x/crypto/ssh/terminal doesn't use terminfo, but instead assumes that it is running on a VT100. This is mostly fine today as xterms implement the VT100 escape sequence. But using |
Change https://golang.org/cl/122597 mentions this issue: |
Thanks for the info, Ian. Not wanting to fix x/crypto/ssh/terminal to recognize terminfo now, I checked if we can simply disable the readline feature completely by checking the environment var TERM. But here is a bad news - 'go tool pprof' sets the "TERM" env var to "dumb" unconditionally. cl/122597 disables the colorization code that uses the troublesome ANSI escape code. |
We can change the go tool to only set |
Reproduced the problem similar to the second issue using emacs shell. https://github.com/golang/crypto/blob/master/ssh/terminal/terminal.go#L116 uses only '\r' for enter key, so the readline hangs. |
Change https://golang.org/cl/122879 mentions this issue: |
Change https://golang.org/cl/122975 mentions this issue: |
The clang compiler on some terminals will issue colored error messages, which can confuse tools like cgo. To avoid this we used to set TERM=dumb for all programs started by the go tool. However, that confuses the pprof tool, which doesn't know whether to support fancy editing and colors itself. Instead, change the go tool and the cgo tool to set TERM=dumb where it matters--when invoking the C compiler--rather than in all cases. Updates #26254 Change-Id: I95174f961ac269a50a83f5f9d268219043cba968 Reviewed-on: https://go-review.googlesource.com/122975 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
I have TERM=dumb set in my environment. pprof should not be printing ANSI escape codes:
The text was updated successfully, but these errors were encountered: