fix cross-device error for temp file - fixed #122#320
Merged
Conversation
There was a problem hiding this comment.
Other comments (6)
- backend/os/file_test.go (747-753) This test assumes that two temporary directories created by `s.T().TempDir()` will always be on the same device. This assumption might not hold in all environments, especially in containerized or virtualized test environments. Consider making this test more robust by either creating directories that you know are on the same device or by skipping the test if the directories are on different devices.
- backend/os/file_windows.go (24-29) The UNC path handling could be improved by first checking if the path is a valid UNC path (starts with `\\` and has at least two components). The current implementation might return incorrect results for malformed UNC paths.
- backend/os/file_unix.go (23-40) Consider adding a maximum iteration count to prevent potential infinite loops in case of unexpected behavior from filepath.Dir(). While the parent == p check should catch most cases, having a safety limit would be a good practice for robustness.
-
backend/os/file.go (513-513)
Typo in comment: 'tmep' should be 'temp'.
// match cursor position in temp file - backend/os/file_windows.go (12-14) The function comment states that it "walks up the directory tree until it finds an existing ancestor to resolve the volume", but the implementation doesn't actually walk up the directory tree. It either gets the volume directly from the path or falls back to the current working directory's volume.
- backend/os/file.go (519-519) Consider adding a comment before setting `ok = true` to explain that this prevents the deferred cleanup from running when the function completes successfully.
💡 To request another review, post a new comment with "/windsurf-review".
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.
fixed #122