Repository navigation
fix(utils): key visited directories on BigInt inodes so Windows scans keep sibling folders - #454
Merged
Merged
Conversation
… keep sibling folders
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.
Problem
test (22, windows-latest)failed twice on the v2.3.0 release PR (#453), each time intest/skill-files-project-scope.test.js. One run dropped the home skill file and the other dropped the project one. Real Windows scans had the same bug: skill files went missing at random.walkDirSaferemembers visited directories by`${st.dev}:${st.ino}`so it can detect loops. On NTFS, file IDs are larger than 2^53. A plain-Numberinoloses its low bits, so two sibling folders created one after another can end up with the same key. The walker then treats the second folder as a symlink loop and skips everything inside it.docker-security's Kubernetes directory dedupe uses the same kind of key.Change
src/utils.js: both visited-keystatcalls read{ bigint: true }, so the ID keeps full precision.src/checks/docker-security.js: same change for the Kubernetes dir dedupe.test/walk-inode-key.test.js: simulates the rounding by giving every Numberinothe same value. Before the fix the walker reports a loop and returns one file; after it, it returns both. Red before the fix, green after.changelog.d/454.fixed.md.Verification (Linux, local)
npx vitest run test/walk-inode-key.test.js: red before the fix, green after.npm test: 2522 passed, 59 skipped.npm run verify:docs: OK.npm run test:fixture: 5 passed.Windows is checked by this PR's
test (22, windows-latest)job.