Files
hermes-agent/pm/filesystem.py
ethernet 3af8084671 fix(pm): support junction checks during legacy Python bootstrap
Python 3.11 fails while PM records the replacement interpreter's tree digest. The bootstrap cannot require Path.is_junction before it installs the managed Python.

Use Windows reparse metadata for junction detection in the store and data cleanup. Retain junction target protection without requiring the newer pathlib API.

Verified the exact failure on real Python 3.11 before the fix. Cold provisioning and source-update relaunch pass afterward. Targeted tests: 16 passed, one Windows-only test skipped on Linux. Ruff passed. The full suite and native Windows test were not run.
2026-09-12 11:01:12 -04:00

12 lines
376 B
Python

"""Filesystem checks used before PM can replace the caller's interpreter."""
from __future__ import annotations
import os
from pathlib import Path
import stat
def is_junction(path: Path) -> bool:
"""Keep junctions opaque even before Python 3.12's Path.is_junction exists."""
return os.name == "nt" and path.lstat().st_reparse_tag == stat.IO_REPARSE_TAG_MOUNT_POINT