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

tools: this relates to #14336, fixes the 'make lint' portion with non-ascii build file path #16047

Closed
wants to merge 4 commits into from

Conversation

sharkfisher
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

deps

@nodejs-github-bot nodejs-github-bot added the v8 engine Issues and PRs related to the V8 dependency. label Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 6, 2017
if not output_base:
raise Exception("Base output directory must be specified")
config_file = arg_options.config
if not config_file:
raise Exception("Config file name must be specified")
config_base = os.path.dirname(config_file)
config_base = os.path.dirname(config_file).decode('utf-8')
Copy link
Member

Choose a reason for hiding this comment

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

No changes should be made to the deps. Those changes should only happen upstream.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

Copy link
Member

Choose a reason for hiding this comment

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

Changes to this effect were already made upstream-upstream, btw: https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/574858 … ping @ak239

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

tools/cpplint.py change LGTM

@refack refack self-assigned this Oct 7, 2017
@refack
Copy link
Contributor

refack commented Oct 7, 2017

Welcome @sharkfisher and thank for this contribution 🥇
The fix to cpplint.py LGTM.
As others have commented, the files in the /deps/ directory are usually "vendored in" from upstream projects. In this case from V8, and as @addaleax commented, a CL was submitted to address this issue, so it should get here after it lands.

@refack
Copy link
Contributor

refack commented Oct 7, 2017

Quick CI check: https://ci.nodejs.org/job/node-test-linter/12296/ ✔️

@addaleax
Copy link
Member

addaleax commented Oct 7, 2017

@refack That CL already landed, it just waits to be rolled into V8

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

Since the upstream change was merged I suppose it makes sense to follow suit but decoding as UTF-8 won't work when the path contains e.g. Latin-1 characters.

tools/cpplint.py Outdated
@@ -1075,7 +1075,7 @@ def RepositoryName(self):
fullname = self.FullName()
# XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory.
toplevel = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/')
os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/').decode('utf-8')
Copy link
Member

Choose a reason for hiding this comment

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

Can you wrap this at 80 columns?

@gibfahn
Copy link
Member

gibfahn commented Oct 7, 2017

Since the upstream change was merged I suppose it makes sense to follow suit but decoding as UTF-8 won't work when the path contains e.g. Latin-1 characters.

Were these supported before? This seems like a net positive.

@bnoordhuis
Copy link
Member

cpplint.py currently is file system encoding-agnostic. The bug in #14336 seems to be primarily CodeGenerator.py mixing byte strings and unicode strings.

@sharkfisher sharkfisher changed the title deps: this fixes #14336, non-ascii build file path when running make tools: this relates to #14336, fixes the 'make lint' portion with non-ascii build file path Oct 10, 2017
@sharkfisher
Copy link
Contributor Author

so I removed changes to CodeGenerator.py since it will be fixed by upstream, and reformatted cpplint.py to stay within 80 cols. So now the only change is to let "make lint" pass when build path has non-ascii chars, it's not directly addressing bug #14336, but is related to it once "make" passes.

@BridgeAR
Copy link
Member

@bnoordhuis PTAL

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

With the CodeGenerator.py changes gone, I don't think there is much reason to make changes to cpplint.py - it shouldn't need them.

@sharkfisher
Copy link
Contributor Author

CodeGenerator.py change only fixes "make" for me.
"make lint" was still failing until cpplint.py change is in.

@bnoordhuis
Copy link
Member

What error do you get? As I mentioned earlier, cpplint.py is (or should be) encoding-agnostic.

@sharkfisher
Copy link
Contributor Author

sharkfisher commented Oct 19, 2017

$ pwd
/Users/mzhang/Documents/node/弄得/node

$ make lint
Running JS linter...
./node tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
	  benchmark doc lib test tools
Running C++ linter...
Traceback (most recent call last):
  File "tools/cpplint.py", line 6094, in <module>
    main()
  File "tools/cpplint.py", line 6087, in main
    ProcessFile(filename, _cpplint_state.verbose_level)
  File "tools/cpplint.py", line 5950, in ProcessFile
    extra_check_functions)
  File "tools/cpplint.py", line 5798, in ProcessFileData
    CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
  File "tools/cpplint.py", line 5439, in CheckForIncludeWhatYouUse
    (same_module, common_path) = FilesBelongToSameModule(abs_filename, header)
  File "tools/cpplint.py", line 5333, in FilesBelongToSameModule
    files_belong_to_same_module = filename_cc.endswith(filename_h)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 29: ordinal not in range(128)
make[1]: *** [lint-cpp] Error 1
make: *** [lint] Error 2

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

Huh, interesting. It's a bit of a shame that it swaps one encoding issue for another (Latin-1 stops working, UTF-8 starts working) but UTF-8 is probably the most prevalent of the two.

toplevel = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/')
toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) \
.replace('\\', '/').decode('utf-8')
Copy link
Member

Choose a reason for hiding this comment

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

This might be a little easier to read as:

toplevel = os.path.abspath(...)
toplevel = toplevel.decode('utf-8')

@Trott
Copy link
Member

Trott commented Oct 27, 2017

refack pushed a commit that referenced this pull request Oct 27, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@refack
Copy link
Contributor

refack commented Oct 27, 2017

Landed in 22882d4

@sharkfisher congrats on being promoted from
image
to
image
🍾

@refack refack closed this Oct 27, 2017
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
PR-URL: nodejs/node#16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
PR-URL: nodejs/node#16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 16, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
MylesBorins pushed a commit that referenced this pull request Nov 21, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
PR-URL: #16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#16047
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@refack refack removed their assignment Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants