-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Pasting (or sending text) in terminal can scramble the input #127699
Comments
I should have included one more thing, my terminal profile:
|
Thanks for the write up, chances are this is indeed related to vscode/src/vs/platform/terminal/node/terminalProcess.ts Lines 358 to 370 in 708951c
vscode/src/vs/platform/terminal/node/terminalProcess.ts Lines 390 to 394 in 708951c
This is a shame as it's already a hack and has problems that pastes can take quite a while when large. This is where the write chunk mechanism was added: d92c1a8 Not sure what we should do here as I've received bug reports about pastes taking too long and increasing that is just a hack on a hack. |
Tracking down and eliminating the race condition that allows out of order writes would be ideal. Then the write delay could be eliminated entirely. |
We just write to a named pipe though, so the race would be in some upstream component outside this project. |
This is a very serious problem. It's just a question of time before some one paste |
I think I started to get this after I recently update Git Bash using scoop. I tried to use the UCRT64 terminal from MSYS2, and it doesn't do this. I think it's related to MINGW64 specifically? |
My entire team and I are also seeing this issue in the integrated terminal on windows when sending command sequences to the terminal via several different independent methods. The issue seems to occur more frequently when larger amounts of text are sent to the terminal. And the issue can always be fixed temporarily be closing the offending terminal instance, at which time when sending a new command causes a new terminal to be created, the command will not error out on this first command, but every command sent to that terminal afterwards is susceptible to this bug, at seemingly random intervals. I'm able to independently reproduce the issue using any of the following extensions to send text to the integrated terminal: I'm running a MSYS2 bash terminal on windows 10 Enterprise and Windows 11. In order to reproduce, I just send a large echo command "echo 1233456..." with a few hundred characters, and after a few back to back runs, the corruptions start appearing. Also, turning off gpu accelerating seems to reduce the frequency of the issue very slightly, but does not fully fix/prevent it when large amounts of text are sent to the terminal. |
I doubt that's related to the problem, if anything turning off GPU acceleration consumes more CPU time which could sloww the text events getting sent to the shell. |
I've been browsing around in the terminal classes and found some potentially guilty uses of
vscode/src/vs/platform/terminal/node/terminalProcess.ts Lines 478 to 497 in e572968
TerminalDataBufferer.startBuffering also has a potentially responsible asynchronous setTimeout vscode/src/vs/platform/terminal/common/terminalDataBuffering.ts Lines 27 to 50 in e572968
TerminalProcess ' IPty.onData whos "IPty#onData" trace logs show the corrupted text that was sent to the terminal when I was reproducing the issue.vscode/src/vs/platform/terminal/node/terminalProcess.ts Lines 301 to 318 in e572968
|
Thanks @wedgberto for looking into this, since the |
@wedgberto can you confirm whether you have |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
I also have this issue sporadically, with bash under windows. |
@Tyriar I had terminal.integrated.windowsEnableConpty set, btw. |
Issue Type: Bug
Text copied to an integrated terminal tab configured to use Cygwin bash is sometimes scrambled. I have observed this both when launching a debug task that copies a command line to a shell and manually pasting from the clipboard.
I can reproduce this problem as follows.
Copy the 60 character string "echo 56789b123456789c123456789d123456789e123456789f123456789" then paste repeatedly into a terminal tab running Cygwin bash.
First attempt:
That worked. Second attempt:
That failed. The failure frequency I experience is about 1 in 10.
Notice that the pasted text in the second case was reordered, with the first 50 characters rotated to the end. That 50 character granularity is apparent in every failure I have examined, including the longer strings generated by debug task launches. Checking the source, I see
MAX_WRITE_CHECK_SIZE = 50
in terminalProcess.ts in code addressing a similar issue, likely related to my 50 character observation.In case it matters, the version of bash I'm running is "4.4.12(3)-release" and cygwin.dll version is "3.2.0(0.340/5/3)".
VS Code version: Code 1.57.1 (507ce72, 2021-06-17T13:28:07.755Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: