-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
fs: fix rmSync to handle non-ASCII characters #56117
Conversation
0486aea
to
f4a6ab5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the linter issues addressed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56117 +/- ##
==========================================
- Coverage 89.22% 89.16% -0.06%
==========================================
Files 663 665 +2
Lines 191974 192604 +630
Branches 36926 37055 +129
==========================================
+ Hits 171286 171742 +456
- Misses 13561 13664 +103
- Partials 7127 7198 +71
|
Can you please update your first commit message to follow the guideline, i.e. each line needs to be below 72 chars. Also there are some linting issues in your js test. |
Update fs.rmSync to properly handle file paths that include non-ASCII characters. This change prevents crashes and errors when attempting to delete files with international or special characters in their names. Add a test in test/parallel to ensure that files with non-ASCII characters can be deleted without issues. This covers cases that previously caused unexpected behavior or crashes on certain file systems. Fixes: #56049
423c7d3
to
f434191
Compare
@jazelly I made the updates for the first commit message and linter issues. I think it should be fine now. |
3931460
to
2572f57
Compare
@jazelly This time a linter issue: I didn't put a newline at the end of the test file. I am learning new things! Thanks for your understanding. |
@jazelly @joyeecheung It's updated based on the review. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have Tou8StringView() function thats added in #54653, why don't we use it? I don't see any reason to add a new implementation for this. @joyeecheung @nodejs/cpp-reviewers
This doesn't add new implementation of the conversion, it just moves existing conversion macros to somewhere earlier so that it can be used in an earlier function. If you want the conversion macros to use ToU8StringView() instead of via wide strings, I think it would be better if you open a separate PR to update these macros. For the purpose of fixing this bug, which has an increasing amount of reports being filed, I think what's done in this PR is adequate, and there is no need to block a bug fix because the existing helper it uses could've been worked better in a separate PR. |
I agree with @joyeecheung here. The conversion to use |
It looks like the CI is failing on Windows:
|
It seems to fail on the additional test that is being added. @Yeaseen Did you test it under Windows? |
@lemire No. I will be trying this on Windows. I thought it was a simple fix. |
Famous last words. 😄 |
@joyeecheung I think I figured out the main problem: it was in |
@lemire could you please review this and start a CI? I tested this locally, though. Thank you. |
There's a conflict because some other code already modified what I worked on. I am gonna do this task on a fresh PR |
This is my first pull request here and I read the contribution guide and commit guide.
Update
fs.rmSync
insrc/node_file.cc
to properly handle file paths that include non-ASCII characters. This change prevents crashes and errors when attempting to delete files with international or special characters in their names.Add a test in
test/parallel/test-fs-rmSync-special-char.js
to ensure that files with non-ASCII characters can be deleted without issues, covering cases that previously led to unexpected behavior or crashes on certain file systems.Fixes: #56049
For building the node and running the tests, I used: