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

repl: strange behaviour in the last nightlies on Windows #18189

Closed
vsemozhetbyt opened this issue Jan 16, 2018 · 5 comments
Closed

repl: strange behaviour in the last nightlies on Windows #18189

vsemozhetbyt opened this issue Jan 16, 2018 · 5 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. tty Issues and PRs related to the tty subsystem. windows Issues and PRs related to the Windows platform.

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Jan 16, 2018

  • Version: 10.0.0 nightly 2018 01 14–16
  • Platform: Windows 7 x64, cmd.exe shell
  • Subsystem: repl

Steps to reproduce:

  1. download a Windows nightly from 2018 01 14 up to 2018 01 16.
  2. Start REPL session.
  3. Evaluate some last commands from the history with UP+ENTER keys.

Anomalies:

  1. Strange prompt symbols / output wrappings (ANSI escape codes?).
  2. These symbols are preserved and added with each UP key press.
  3. The output is decolorized.
10.0.0 nightly 2018 01 13 screenshot:

13


10.0.0 nightly 2018 01 14–16 screenshot:

14-16


Not sure if this is reproducible in other OSs.

@vsemozhetbyt vsemozhetbyt added repl Issues and PRs related to the REPL subsystem. windows Issues and PRs related to the Windows platform. labels Jan 16, 2018
@apapirovski
Copy link
Member

/cc @addaleax it seems very likely this is related to 8b751f7

@addaleax
Copy link
Member

@vsemozhetbyt @apapirovski Thanks, I’ll take a look!

@addaleax addaleax added fs Issues and PRs related to the fs subsystem / file system. tty Issues and PRs related to the tty subsystem. and removed repl Issues and PRs related to the REPL subsystem. labels Jan 17, 2018
@addaleax
Copy link
Member

addaleax commented Jan 17, 2018

Fwiw, I cannot reproduce the exact problem as described by you, but printing a simple non-ASCII string like '\xf6' seems to be enough to trigger this issue. :/

But yes, it seems like this is being triggered by #18019, and in released versions of Node this also doesn't quite work the way I'd expect it to:

> fs.writeSync(1, 'Ö\n')
Ö
3

I guess that's happening because the default code page isn't expecting UTF-8?

Thinking a bit harder about it, I think it's okay to just revert the changes to lib/tty.js from that PR. libuv supports blocking uv_try_write()s for TTYs across platforms, and even if that were not the case, nothing terribly bad actually happens. (I'll open a PR with that shortly.)


As a side note: We currently actually recommend fs.writeSync(1, ...) in the async_hooks docs as a way to do synchronous logging. If that is broken on Windows we might want to re-think that recommendation and/or just expose process._rawDebug or some other fprintf(stderr, ...) thingy as public API. /cc @AndreasMadsen

addaleax added a commit to addaleax/node that referenced this issue Jan 17, 2018
This broke writing non-ASCII data to the console on Windows because
the result would be codepage-dependent.

This partially reverts 8b751f7.

Fixes: nodejs#18189
Refs: nodejs#18019
@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Jan 17, 2018

FWIW, changing of a shell code page seems to not fix the issue:

> chcp 65001
Active code page: 65001

> node.10.0.0.v8-6.3.20180116.nightly.exe
 [1G [0J>  [3G

> chcp 1252
Active code page: 1252

> node.10.0.0.v8-6.3.20180116.nightly.exe
�[1G�[0J> �[3G

> chcp 850
Active code page: 850

> node.10.0.0.v8-6.3.20180116.nightly.exe
←[1G←[0J> ←[3G

@addaleax
Copy link
Member

@vsemozhetbyt Can you try #18214 and see if you’re still seeing those issues?

addaleax added a commit that referenced this issue Feb 26, 2018
This broke writing non-ASCII data to the console on Windows because
the result would be codepage-dependent.

This partially reverts 8b751f7.

Fixes: #18189
Refs: #18019

PR-URL: #18214
Fixes: #18189
Refs: #18019
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
addaleax added a commit that referenced this issue Feb 26, 2018
This broke writing non-ASCII data to the console on Windows because
the result would be codepage-dependent.

This partially reverts 8b751f7.

Fixes: #18189
Refs: #18019

PR-URL: #18214
Fixes: #18189
Refs: #18019
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
This broke writing non-ASCII data to the console on Windows because
the result would be codepage-dependent.

This partially reverts 8b751f7.

Fixes: nodejs#18189
Refs: nodejs#18019

PR-URL: nodejs#18214
Fixes: nodejs#18189
Refs: nodejs#18019
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this issue Aug 17, 2018
This broke writing non-ASCII data to the console on Windows because
the result would be codepage-dependent.

This partially reverts 8b751f7.

Fixes: #18189
Refs: #18019

PR-URL: #18214
Fixes: #18189
Refs: #18019
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. tty Issues and PRs related to the tty subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants