Skip to content

fix: detect symlink cycles in collectFiles - #38

Merged
royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
sharadvc:cursor/symlink-cycle-detection-7aba
Sep 12, 2026
Merged

fix: detect symlink cycles in collectFiles#38
royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
sharadvc:cursor/symlink-cycle-detection-7aba

Conversation

@sharadvc

Copy link
Copy Markdown
Contributor

Summary

collectFiles now tracks visited directories by dev:ino before recursing, so symlink cycles are skipped instead of walking until ELOOP or hanging. Per-entry statSync errors are ignored so one bad symlink does not stop the scan.

Test plan

  • npm test — cycle fixture finishes quickly; benign alias still yields scannable files

Fixes #10

Track visited directory device/inode pairs so symlink loops cannot
recurse indefinitely. Add tests for cyclic and benign directory symlinks.

Fixes AgentPostmortem#10

Co-authored-by: Sharad. <sharadvc@users.noreply.github.com>
@royalpinto007
royalpinto007 merged commit 0866b2a into AgentPostmortem:main Sep 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

collectFiles follows symlinks with no cycle detection

3 participants