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

util: escape C1 control characters and switch to hex format #29826

Closed
wants to merge 1 commit into from

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Oct 3, 2019

C1 control characters will from now on also be escaped to prevent
altering the terminal behavior.

This also switches '\u00XX' to '\xXX' as suggested by @dd-pardal. The reason for me to switch is that it uses less characters.

Fixes: #29450

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@BridgeAR BridgeAR added util Issues and PRs related to the built-in util module. semver-major PRs that contain breaking changes and should be released in the next major version. labels Oct 3, 2019
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Oct 3, 2019

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 9, 2019
@nodejs-github-bot
Copy link
Collaborator

Trott
Trott previously requested changes Oct 11, 2019
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows test failure in test-fs-whatwg-url is relevant.

AssertionError [ERR_ASSERTION]: Expected "actual" to be reference-equal to "expected":
+ actual - expected

  Comparison {
    code: 'ERR_INVALID_ARG_VALUE',
+   message: "The argument 'path' must be a string or Uint8Array without null bytes. Received 'c:\\\\tmp\\\\\\x00test'",
-   message: "The argument 'path' must be a string or Uint8Array without null bytes. Received 'c:\\\\tmp\\\\\\u0000test'",
    type: [Function: TypeError]
  }
    at new AssertionError (internal/assert/assertion_error.js:418:11)
    at Object.innerFn (c:\workspace\node-test-binary-windows-2\test\common\index.js:617:15)
    at expectedException (assert.js:642:26)
    at expectsError (assert.js:767:3)
    at Function.throws (assert.js:816:3)
    at Object.expectsError (c:\workspace\node-test-binary-windows-2\test\common\index.js:629:12)
    at Object.<anonymous> (c:\workspace\node-test-binary-windows-2\test\parallel\test-fs-whatwg-url.js:58:10)
    at Module._compile (internal/modules/cjs/loader.js:946:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:963:10)
    at Module.load (internal/modules/cjs/loader.js:797:32) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: [NodeError],
  expected: [Object],
  operator: 'common.expectsError'
}

@Trott Trott removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 11, 2019
@Trott
Copy link
Member

Trott commented Oct 11, 2019

@nodejs/citgm-admins Is it just me or do the Window results not seem to report their failures in the citgm-smoker Jenkins job?

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR
Copy link
Member Author

@Trott fixed. I also fixed two faulty escape entries. PTAL

@Trott Trott dismissed their stale review November 12, 2019 14:57

test fixed

@BridgeAR BridgeAR added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Nov 12, 2019
C1 control characters will from now on also be escaped to prevent
altering the terminal behavior.

Fixes: nodejs#29450
@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 18, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

addaleax pushed a commit that referenced this pull request Nov 19, 2019
C1 control characters will from now on also be escaped to prevent
altering the terminal behavior.

Fixes: #29450

PR-URL: #29826
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@addaleax
Copy link
Member

Landed in 0f78dcc

@addaleax addaleax closed this Nov 19, 2019
@BridgeAR BridgeAR deleted the escape-c1-controls branch January 20, 2020 12:05
@sam-github
Copy link
Contributor

Escaped in what contexts? Is it just in format string interpolation?

Being able to use control characters to control the terminal is a feature, I assume this won't break CLI apps with interactive features, or there would be an uproar, but I don't know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. semver-major PRs that contain breaking changes and should be released in the next major version. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C1 control characters not escaped by formatter
7 participants