Skip to content
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

Failing to clear wrapped line #4759

Closed
Liamolucko opened this issue Mar 1, 2020 · 9 comments
Closed

Failing to clear wrapped line #4759

Liamolucko opened this issue Mar 1, 2020 · 9 comments
Labels
Area-VT Virtual Terminal sequence support Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered

Comments

@Liamolucko
Copy link

Liamolucko commented Mar 1, 2020

Environment

Windows build number: 10.0.18362.657
Windows Terminal version (if applicable): Not sure; latest version on Microsoft Store as of 2020-03-01

Any other software?
PowerShell 6.2.4
Python 3.7.6
TensorFlow 1.14.0

Steps to reproduce

Run a TensorFlow program which attempts to clear a line that exceeds the size of the window and is wrapped onto the next line.
If the window is wide enough to fit the entire line, this is not an issue.

Expected behavior

The entire 'line' should be deleted

212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_
bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483

Actual behavior

Only the last line of the wrapped line is cleared, leaving behind lots of cut off lines.

190/723 [======>.......................] - ETA: 27:10 - loss: 1.6521 - rpn_class_loss: 0.0285 - rpn_
191/723 [======>.......................] - ETA: 27:06 - loss: 1.6524 - rpn_class_loss: 0.0284 - rpn_
192/723 [======>.......................] - ETA: 27:02 - loss: 1.6509 - rpn_class_loss: 0.0283 - rpn_
193/723 [=======>......................] - ETA: 26:58 - loss: 1.6483 - rpn_class_loss: 0.0284 - rpn_
194/723 [=======>......................] - ETA: 26:54 - loss: 1.6486 - rpn_class_loss: 0.0283 - rpn_
195/723 [=======>......................] - ETA: 26:51 - loss: 1.6507 - rpn_class_loss: 0.0282 - rpn_
196/723 [=======>......................] - ETA: 26:47 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_
197/723 [=======>......................] - ETA: 26:43 - loss: 1.6626 - rpn_class_loss: 0.0282 - rpn_
198/723 [=======>......................] - ETA: 26:40 - loss: 1.6598 - rpn_class_loss: 0.0282 - rpn_
199/723 [=======>......................] - ETA: 26:36 - loss: 1.6653 - rpn_class_loss: 0.0281 - rpn_
200/723 [=======>......................] - ETA: 26:33 - loss: 1.6666 - rpn_class_loss: 0.0282 - rpn_
201/723 [=======>......................] - ETA: 26:30 - loss: 1.6665 - rpn_class_loss: 0.0283 - rpn_
202/723 [=======>......................] - ETA: 26:28 - loss: 1.6713 - rpn_class_loss: 0.0283 - rpn_
203/723 [=======>......................] - ETA: 26:24 - loss: 1.6662 - rpn_class_loss: 0.0283 - rpn_
204/723 [=======>......................] - ETA: 26:20 - loss: 1.6652 - rpn_class_loss: 0.0282 - rpn_
205/723 [=======>......................] - ETA: 26:16 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_
206/723 [=======>......................] - ETA: 26:13 - loss: 1.6575 - rpn_class_loss: 0.0281 - rpn_
207/723 [=======>......................] - ETA: 26:09 - loss: 1.6591 - rpn_class_loss: 0.0280 - rpn_
208/723 [=======>......................] - ETA: 26:05 - loss: 1.6565 - rpn_class_loss: 0.0279 - rpn_
209/723 [=======>......................] - ETA: 26:03 - loss: 1.6592 - rpn_class_loss: 0.0279 - rpn_
210/723 [=======>......................] - ETA: 25:59 - loss: 1.6577 - rpn_class_loss: 0.0280 - rpn_
211/723 [=======>......................] - ETA: 25:56 - loss: 1.6591 - rpn_class_loss: 0.0279 - rpn_
212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_
bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 1, 2020
@Liamolucko
Copy link
Author

This is probably related to the issues in #4200

@Liamolucko Liamolucko changed the title Failing to clear entire line Failing to clear wrapped line Mar 1, 2020
@Liamolucko
Copy link
Author

Liamolucko commented Mar 1, 2020

This doesn't seem to be an issue with Windows Terminal - it happens in both PowerShell and Command Prompt in the default windows shell, so it's probably an issue with TensorFlow.

@DHowett-MSFT
Copy link
Contributor

Huh, thanks for following up. Does it reproduce in other terminals that work like xterm? That’s the compatibility level we’re going for :)

@Liamolucko
Copy link
Author

I tried it in Git Bash & Cygwin, since they both use mintty, but it doesn't seem to support deleting lines at all.

@Liamolucko
Copy link
Author

Liamolucko commented Mar 14, 2020

Okay, I've figured out that the specific problem is that TensorFlow is using carriage return (\r) for this.

My test:

for i in range(5):
    print((str(i) * 200) + '\r', end='')

print()

Note: I added the empty print() statement at the end so that the terminal wouldn't overwrite the last line.

Expected:

444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
44444444444444444444444444444444444444444444444444444444444444444444444444444444

Output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
44444444444444444444444444444444444444444444444444444444444444444444444444444444

Note: This also occured in VS Code's integrated terminal

Strangely, MinTTY had the same behaviour as Command Prompt and Windows Terminal this time.

@Liamolucko
Copy link
Author

Should this issue be fixed? It seems to happen in pretty much every terminal.

It behaves this way in:

  • Windows Terminal
  • Command Prompt
  • MinTTY
  • VS Code Integrated Terminal
  • Terminal.app

@Liamolucko Liamolucko reopened this Mar 14, 2020
@DHowett-MSFT
Copy link
Contributor

Say, are you using python for Windows or python inside WSL?

@DHowett-MSFT DHowett-MSFT added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 14, 2020
@Liamolucko
Copy link
Author

Python for Windows, versions 3.7.6 and 3.8.0.

I just tested it on WSL though, same behaviour (Python 3.6.7)

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 16, 2020
@zadjii-msft
Copy link
Member

I'm gonna say that this should be resolved as "by-design". I just tried this out in gnome-terminal and I'm seeing the same behavior with your simple repro case as what happens in conhost and Windows Terminal. I'd bet that this is just a misunderstanding by the TensorFlow maintainers that \r won't take you to the beginning of a wrapped line if the line started on another row, it'll only take you to the start of the current row.

@zadjii-msft zadjii-msft added Area-VT Virtual Terminal sequence support Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered labels Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Question For questions or discussion Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

3 participants