Skip to content

fix: list dir with depth > 3#1402

Merged
dobrac merged 4 commits into
mainfrom
fix-list-dir-depth-panic
Oct 23, 2025
Merged

fix: list dir with depth > 3#1402
dobrac merged 4 commits into
mainfrom
fix-list-dir-depth-panic

Conversation

@dobrac
Copy link
Copy Markdown
Contributor

@dobrac dobrac commented Oct 23, 2025

Fix panic in envd causing list directory with depth > 3 to fail.

The error after fixing the panic was the following. The file didn't exist between the walkdir calls. I think it's safe to ignore these when walking a directory.

error reading directory /: not_found: file not found: lstat /proc/299/fd/9: no such file or directory


Note

Skips entries that disappear during directory traversal and updates envd version to 0.4.2.

  • Filesystem (packages/envd/internal/services/filesystem/dir.go):
    • walkDir: ignore not_found errors by skipping entries that no longer exist during traversal; replace unused entry param with _.
    • Add errors import and use error unwrapping to detect connect.CodeNotFound.
  • Versioning (packages/envd/main.go):
    • Bump Version from 0.4.1 to 0.4.2.

Written by Cursor Bugbot for commit 2669741. This will update automatically on new commits. Configure here.

@dobrac dobrac added the bug Something isn't working label Oct 23, 2025
@cursor
Copy link
Copy Markdown

cursor Bot commented Oct 23, 2025

Bug: WalkDir Silently Ignores Critical Errors

The filepath.WalkDir callback unconditionally returns nil for all errors from entryInfo that are not NotFound errors. This silently ignores critical issues like permission or I/O errors, preventing them from propagating and potentially resulting in an incomplete directory walk.

Fix in Cursor Fix in Web

@sitole sitole self-requested a review October 23, 2025 11:29
Copy link
Copy Markdown
Member

@sitole sitole left a comment

Choose a reason for hiding this comment

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

Please bump envd version

@dobrac dobrac requested a review from sitole October 23, 2025 13:47
@cursor
Copy link
Copy Markdown

cursor Bot commented Oct 23, 2025

Bug: walkDir Fails to Handle Missing Directories

The walkDir function's error handling for NotFound errors returns nil when a non-existent directory is encountered. This prevents filepath.WalkDir from skipping the directory subtree, causing it to continue attempting to traverse the non-existent path and potentially leading to further errors.

Fix in Cursor Fix in Web

@dobrac dobrac merged commit ad5bb9b into main Oct 23, 2025
27 checks passed
@dobrac dobrac deleted the fix-list-dir-depth-panic branch October 23, 2025 14:15
ValentaTomas pushed a commit that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants