Conversation
Moving a file to a name that differs only in Unicode normalization form (NFC vs NFD) throws "Source and destination must not be the same." on filesystems that auto-normalize, such as APFS, even though the source and destination are visually identical and the user is just renaming the file. This mirrors the case-insensitive rename bug fixed in jprichardson#801, so it gets the same fix: when the basenames differ but resolve to the same inode, and they're equal after either lowercasing or NFC normalization, treat it as a rename instead of raising the same-path error. Fixes jprichardson#859
RyanZim
reviewed
Sep 8, 2026
Collaborator
|
Pushed changes to properly handle changing case & Unicode normalization format at the same time, along with tests. |
manidlou
approved these changes
Sep 17, 2026
manidlou
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thank you @afonsojanu and @RyanZim
JPeer264
approved these changes
Sep 18, 2026
Collaborator
|
Published in v11.4.1 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #859.
Moving a file to a name that differs only in Unicode normalization form (NFC vs NFD, like
caféwritten as one precomposed character versuseplus a combining accent) throwsSource and destination must not be the same.on filesystems that auto-normalize names, APFS being the common case. The two names look identical to a person, and topath.basename, but the filesystem folds them onto the same inode, so the existing "same file" check trips even though this is really just a rename.This is the same shape of bug as #759/#801 (renaming to change letter case only), which already has a fix in
checkPaths/checkPathsSync: if the basenames differ as strings but resolve to the same inode, and are equal after some normalization, treat it as a legitimate rename rather than raising the same-path error. I extended that existing check to also cover NFC-equality, alongside the case-insensitive comparison already there.Verified against a real reproduction on macOS/APFS:
moveSync/moveboth threw before the change and succeed after it. Added two small regression tests (move-unicode-normalization-paths.test.jsand the sync equivalent) following the pattern of the existing case-insensitive tests. Full suite (736 tests) plus lint pass locally.