Fixed an issue that caused a segmentation fault when resolving a module in certain environments#56657
Fixed an issue that caused a segmentation fault when resolving a module in certain environments#56657yamachu wants to merge 2 commits intonodejs:mainfrom
Conversation
Enforce that it is u8 because it was crashing when loading files containing Japanese in Windows, cp392 environment. Fixes: nodejs#56650
I guess there is no easy way to add a test, right? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56657 +/- ##
==========================================
- Coverage 89.21% 89.21% -0.01%
==========================================
Files 662 662
Lines 191893 191895 +2
Branches 36931 36928 -3
==========================================
- Hits 171196 171191 -5
- Misses 13541 13546 +5
- Partials 7156 7158 +2
|
|
Yes. |
|
I have succeeded in reproducing the Japanese environment Windows on CI. https://github.com/yamachu/node-require-japanese-repro/actions/runs/12861537170 To prepare a test using this setup in the node repository, I also need a node build workflow for Windows, which is difficult for me... |
|
Can you please fix the linting errors? |
|
@lpinca I ran make test but forgot to run make lint, sorry. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Thank you for the review. Since I was able to create a ja-JP environment with CI, I performed tests using it. Default Windows runner Failed tests:
D:\a\node\node\out\Release\node.exe --experimental-vm-modules --max-old-space-size=16 --trace-gc D:\a\node\node\test\es-module\test-vm-source-text-module-leak.js
D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-child-process-exec-any-shells-windows.js
D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-inspector-wait-for-connection.js
+ D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-require-unicode.js
D:\a\node\node\out\Release\node.exe --expose-internals D:\a\node\node\test\pummel\test-heapdump-inspector.jsSJIS Windows runner Failed tests:
D:\a\node\node\out\Release\node.exe --experimental-vm-modules --max-old-space-size=16 --trace-gc D:\a\node\node\test\es-module\test-vm-source-text-module-leak.js
D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-child-process-exec-any-shells-windows.js
- D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-module-create-require-multibyte.js
D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-require-unicode.js
D:\a\node\node\out\Release\node.exe D:\a\node\node\test\parallel\test-inspector-wait-for-connection.js
D:\a\node\node\out\Release\node.exe --expose-internals D:\a\node\node\test\pummel\test-heapdump-inspector.js |
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: nodejs#56696 Fixes: nodejs#56650 Refs: nodejs#56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#56696 Fixes: nodejs#56650 Refs: nodejs#56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#56696 Fixes: nodejs#56650 Refs: nodejs#56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: nodejs#56696 Fixes: nodejs#56650 Refs: nodejs#56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Take a similar approach to node_file and allow the creation of paths code point must be specified to convert from wchar_t to utf8. PR-URL: #56696 Fixes: #56650 Refs: #56657 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fix: #56650
This PR fixes a problem that caused a segmentation fault in module resolution when creating a require object with multibyte characters in a non-English environment.
Since the issue occurred when generating a std::filesystem::path object, some patches were applied to the changed areas in the following PR.
a7dad43
Caution
It cannot be reproduced by using
chcpcommand in a Windows environment, and it is necessary to change the locale in the OS settings...