mirror of
https://github.com/Aider-AI/aider
synced 2026-04-25 17:15:07 +02:00
Path.resolve() raises RuntimeError on circular symlinks. Catch RuntimeError and OSError, fall back to Path.absolute(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
410 B
Python
16 lines
410 B
Python
import os
|
|
|
|
from aider.utils import safe_abs_path
|
|
|
|
|
|
def test_safe_abs_path_symlink_loop(tmp_path):
|
|
# Create circular symlink: a -> b -> a
|
|
link_a = tmp_path / "link_a"
|
|
link_b = tmp_path / "link_b"
|
|
link_a.symlink_to(link_b)
|
|
link_b.symlink_to(link_a)
|
|
|
|
# safe_abs_path must not raise, and must return an absolute path
|
|
result = safe_abs_path(str(link_a))
|
|
assert os.path.isabs(result)
|