Commit e986e58
Fix symlink loop detection to allow shared symlink targets
The previous implementation used a single shared list of visited
symlink targets across the entire tree. This caused sibling symlinks
pointing to the same directory to be incorrectly skipped as loops,
because the second symlink found its target already recorded by the
first one.
Replace the shared list with a per-branch set of ancestor real
paths. Each child node gets its own copy of the set, so sibling
branches cannot interfere with each other. A symlink is now only
skipped when its target resolves to an ancestor directory of the
current walk path, which is the actual condition for a cycle.
Add tests for both the shared symlink target scenario and for the
symlink loop detection to prevent future regressions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent e90b1af commit e986e58
2 files changed
Lines changed: 58 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
| 107 | + | |
109 | 108 | | |
110 | | - | |
| 109 | + | |
111 | 110 | | |
112 | | - | |
| 111 | + | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
| |||
708 | 707 | | |
709 | 708 | | |
710 | 709 | | |
| 710 | + | |
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
| |||
754 | 754 | | |
755 | 755 | | |
756 | 756 | | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | 757 | | |
762 | | - | |
| 758 | + | |
763 | 759 | | |
764 | 760 | | |
765 | | - | |
766 | | - | |
767 | 761 | | |
768 | 762 | | |
769 | 763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
578 | 631 | | |
579 | 632 | | |
580 | 633 | | |
| |||
0 commit comments