Skip to content

fix cross-device error for temp file - fixed #122#320

Merged
funkyshu merged 3 commits intomainfrom
fix/cross-device-tempfile
Mar 25, 2026
Merged

fix cross-device error for temp file - fixed #122#320
funkyshu merged 3 commits intomainfrom
fix/cross-device-tempfile

Conversation

@funkyshu
Copy link
Copy Markdown
Member

fixed #122

@c2fo-cibot c2fo-cibot bot added the size/L Denotes a PR that changes 100-499 lines label Mar 25, 2026
Copy link
Copy Markdown

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

@funkyshu funkyshu merged commit 78115e8 into main Mar 25, 2026
34 checks passed
@funkyshu funkyshu deleted the fix/cross-device-tempfile branch March 25, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to specific volume in window in os file?

1 participant