Skip to content

Fails when walking an absolute symlinked path with a ROOT_MARKER #65

@zsol

Description

@zsol

This happens when you fetch a project with a ROOT_MARKER (i.e. .git, .hg, pyproject.toml) into MacOS's system temp.

Easy repro:

tmp=$(mktemp -d)
ln -s "$tmp" foo
touch foo/.git
python -c 'import trailrunner; from pathlib import Path; next(trailrunner.walk(Path.cwd() / "foo"))'

BOOM:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "xxxxlib/python3.11/site-packages/trailrunner/core.py", line 169, in gen
    relative = child.relative_to(root)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "xxxxlib/python3.11/pathlib.py", line 730, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: 'xxxx/foo' is not in the subpath of '/tmp' OR one path is relative and the other is absolute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions