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.
With
PATHunset,shutil.whichand similar lookups still find tools through the default search path (os.confstr("CS_PATH"), elseos.defpath). A harness that builds its child'sPATHfromos.environ.get("PATH", "")then hands that child aPATHholding only its stub directory, or nothing, so the child can't find tools that the parent's lookup just found. #1859 and the fix fortest_configure_archived.pymoved two harnesses to anos.defpathfallback. These three still use the empty one:scripts/tests/test_local_review.py:1060-1061prepends a stub directory toos.environ.get("PATH", "").scripts/tests/test_skills_install.py:718and:767pass{"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 withPATHset. Each site needs its own reading:test_local_review.py:1174-1175deliberately emptiesPATHand restores the previous value, which is a different shape and may be correct as is.Found while answering Copilot's
PATHfindings on the promotion PR #1850.