Repository navigation
fix(scanner): skip files that vanish mid-walk instead of failing (#302) - #303
Open
JordanCoin wants to merge 3 commits into
Open
JordanCoin wants to merge 3 commits into
JordanCoin wants to merge 3 commits into
Conversation
SessionStart:resume could die with "Error walking tree: lstat …: no such file or directory" when a short-lived entry (e.g. watch.transition) was removed between ReadDir and Lstat. Treat that ENOENT as skip; keep a missing walk root fatal. .codemap/ was already in IgnoredDirs; note why. Co-authored-by: Jordan Coin Jackson <jordancoinjackson@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov flagged the topology walk's IsNotExist branches; exercise both entry.Info and directory ReadDir races the same way as the scanner test. Co-authored-by: Jordan Coin Jackson <jordancoinjackson@gmail.com>
…es (#302) DirEntry.Info can return FindFirstFile-cached metadata after a remove, so TestDiscoverInventorySkipsVanishedEntries kept z-vanish.go on windows-latest. Co-authored-by: Jordan Coin Jackson <jordancoinjackson@gmail.com>
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.
What does this PR do?
Fixes #302. When the tree walk lists a directory then
lstats each entry, a short-lived file removed in between (e.g.watch.transitionwhile the watcher runs) used to abort the whole walk withError walking tree: lstat …: no such file or directory, which madeSessionStart:resumefail intermittently on macOS.ENOENT on a non-root walk entry is now skipped; a missing walk root still errors. The same skip is applied in the topology inventory walk (using
os.Lstatso Windows does not keep FindFirstFile-cached metadata after a mid-walk delete)..codemap/was already inIgnoredDirs(#196); the comment now notes that also avoids races on ephemeral state files there.Type of change
Checklist
go build && ./codemap .Additional notes
TestScanFilesSkipsVanishedEntrydeletes a later sibling mid-walk via a test hook and asserts the walk succeeds.TestScanFilesMissingRootStillErrorspins that a missing root is still fatal.TestDiscoverInventorySkipsVanishedEntriescovers topology's file and directory ENOENT skips (also exercises WindowsLstatvs cachedDirEntry.Info).lstat …: no such file or directorysymptom as the issue.