Skip to content

Three Test Harnesses Build a Stand-In PATH With an Empty Fallback When PATH Is Unset #1862

Description

@ptr727

With PATH unset, shutil.which and similar lookups still find tools through the default search path (os.confstr("CS_PATH"), else os.defpath). A harness that builds its child's PATH from os.environ.get("PATH", "") then hands that child a PATH holding only its stub directory, or nothing, so the child can't find tools that the parent's lookup just found. #1859 and the fix for test_configure_archived.py moved two harnesses to an os.defpath fallback. These three still use the empty one:

  • scripts/tests/test_local_review.py:1060-1061 prepends a stub directory to os.environ.get("PATH", "").
  • scripts/tests/test_skills_install.py:718 and :767 pass {"PATH": os.environ.get("PATH", "")} as the child's whole environment.

Reproduce with env -u PATH /usr/bin/python3 -m unittest <module>, and compare against the same run with PATH set. Each site needs its own reading: test_local_review.py:1174-1175 deliberately empties PATH and restores the previous value, which is a different shape and may be correct as is.

Found while answering Copilot's PATH findings on the promotion PR #1850.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions