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: strange linting issue #19250

Closed
vsemozhetbyt opened this issue Mar 9, 2018 · 10 comments
Closed

tools: strange linting issue #19250

vsemozhetbyt opened this issue Mar 9, 2018 · 10 comments
Labels
confirmed-bug Issues with confirmed bugs. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Mar 9, 2018

  • Version: master
  • Platform: Windows 7 x64
  • Subsystem: tools

The case of drive letter (i.e. j: vs J:) causes different behavior. Moreover, this difference is opposite in various shells.

cmd.exe:

j:\temp\_git\node-fork> node j:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

[no errors]

j:\temp\_git\node-fork> node J:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

j:\temp\_git\node-fork\.eslintrc.js
  1:1  error  Definition for rule 'node-core/no-unescaped-regexp-dot' was not found  node-core/no-unescaped-regexp-dot

✖ 1 problem (1 error, 0 warnings)

Git Bash:

vmb@vmb-nb MINGW64 /j/temp/_git/node-fork (master)
$ node j:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

J:\temp\_git\node-fork\.eslintrc.js
  1:1  error  Definition for rule 'node-core/no-unescaped-regexp-dot' was not found  node-core/no-unescaped-regexp-dot

✖ 1 problem (1 error, 0 warnings)

vmb@vmb-nb MINGW64 /j/temp/_git/node-fork (master)
$ node J:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

[no errors]

cc @nodejs/linting @nodejs/platform-windows

@vsemozhetbyt vsemozhetbyt added windows Issues and PRs related to the Windows platform. tools Issues and PRs related to the tools directory. labels Mar 9, 2018
@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 9, 2018

It seems the issue is not in a drive letter, but in case of any letters in a path within case insensitive OS like Windows. Compare (the first directory is titlecased):

j:\temp\_git\node-fork>node j:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

[no errors]

j:\temp\_git\node-fork>node j:/Temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

j:\temp\_git\node-fork\.eslintrc.js
  1:1  error  Definition for rule 'node-core/no-unescaped-regexp-dot' was not found  node-core/no-unescaped-regexp-dot

✖ 1 problem (1 error, 0 warnings)

@seishun
Copy link
Contributor

seishun commented Mar 9, 2018

Probably an issue in eslint.

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 9, 2018

Maybe. I was trying to debug, but I cannot catch the cause, I am not so aware how plugin rules are integrated.

Drive letter miscasing is more often issue than any other miscasing in a path. For example, there is a Windows way to make it possible to call script in the shell instead of node script.js:

ftype JSFile="C:\Program Files\nodejs\node.exe" "%1" %*
assoc .js=JSFile

So, if this is set and a user runs:

tools\node_modules\eslint\bin\eslint .eslintrc.js

it will be expanded by a shell into:

"C:\Program Files\nodejs\node.exe" "J:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js" .eslintrc.js

— with uppercased drive letter. This is how I have stumbled upon this issue.

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 10, 2018

More info to consider re drive letter case:

  1. __filename, __dirname and process.argv are dependent on script argument.
  2. process.cwd() is dependent on a shell.

test.js:

'use strict';

console.log(__filename);
console.log(__dirname);
console.log(process.argv);
console.log(process.cwd());

cmd.exe:

e:\DOC\prg\js\node\-test> node e:\DOC\prg\js\node\-test\test.js
e:\DOC\prg\js\node\-test\test.js
e:\DOC\prg\js\node\-test
[ 'C:\\Program Files\\nodejs\\node.exe',
  'e:\\DOC\\prg\\js\\node\\-test\\test.js' ]
e:\DOC\prg\js\node\-test

e:\DOC\prg\js\node\-test> node E:\DOC\prg\js\node\-test\test.js
E:\DOC\prg\js\node\-test\test.js
E:\DOC\prg\js\node\-test
[ 'C:\\Program Files\\nodejs\\node.exe',
  'E:\\DOC\\prg\\js\\node\\-test\\test.js' ]
e:\DOC\prg\js\node\-test

Git bash:

vmb@vmb-nb MINGW64 /e/DOC/prg/js/node/-test
$ node e:\\DOC\\prg\\js\\node\\-test\\test.js
e:\DOC\prg\js\node\-test\test.js
e:\DOC\prg\js\node\-test
[ 'C:\\Program Files\\nodejs\\node.exe',
  'e:\\DOC\\prg\\js\\node\\-test\\test.js' ]
E:\DOC\prg\js\node\-test

vmb@vmb-nb MINGW64 /e/DOC/prg/js/node/-test
$ node E:\\DOC\\prg\\js\\node\\-test\\test.js
E:\DOC\prg\js\node\-test\test.js
E:\DOC\prg\js\node\-test
[ 'C:\\Program Files\\nodejs\\node.exe',
  'E:\\DOC\\prg\\js\\node\\-test\\test.js' ]
E:\DOC\prg\js\node\-test

It seems ESLint or plugin try to compare these items case-sensitively somewhere.

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 10, 2018

Why it is so difficult to debug: #19273

Breakpoints in dependent files set in this call:

node  --inspect-brk j:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

are not activated at all,

Breakpoints in dependent files set in this call:

node  --inspect-brk J:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js

are skipped if the code is not accessed due to a bug.

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 10, 2018

It's not ESLint, it's us) This is what happens in two mentioned calls:

  1. node j:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js:
  1. node J:/temp/_git/node-fork/tools/node_modules/eslint/bin/eslint.js .eslintrc.js:

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 10, 2018

@devsnek, would it be more comfortable for you to find a fix?

Refs: #18566

@devsnek
Copy link
Member

devsnek commented Mar 15, 2018

I have no idea what's going on here and I don't have a Windows machine so it might be best for someone else to tackle this :)

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented Mar 15, 2018

Additional refs:

https://nodejs.org/api/modules.html#modules_module_caching_caveats

#17611 (the references to other issues and the discussion in comments)

@apapirovski apapirovski added the confirmed-bug Issues with confirmed bugs. label Apr 14, 2018
@apapirovski
Copy link
Member

I usually don't like closing confirmed-bug issues but I really don't know what we can do here and it doesn't seem like anyone else does either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. tools Issues and PRs related to the tools directory. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

4 participants