Skip to content

Honor mixed-case Path overrides when running commands on Windows - #762

Open
Gambit-Checkmate wants to merge 1 commit into
theskumar:mainfrom
Gambit-Checkmate:fix/windows-environment-key-case
Open

Gambit-Checkmate wants to merge 1 commit into
theskumar:mainfrom
Gambit-Checkmate:fix/windows-environment-key-case

Conversation

@Gambit-Checkmate

@Gambit-Checkmate Gambit-Checkmate commented Nov 30, 2026 •

Copy link
Copy Markdown

Fixes #761. On Windows, .env containing Path=... or path=... can produce Command not found while the identical value under PATH runs the command. Windows environment names are case-insensitive, but the dictionary used for explicit command lookup preserves both the inherited uppercase key and the added mixed-case key.

Normalize the added names to uppercase on Windows before merging into the effective environment and looking up PATH. Leave POSIX name handling unchanged. Add native process tests using a harmless copy of cmd.exe with a unique name: these avoid batch-file shell lookup masking the bug. Further subprocess controls verify ordinary variables and --no-override on both case-sensitive and case-insensitive platforms. README/changelog updated.

Validation on Windows / CPython 3.13.13:

  • Original main: 3 new PATH regressions fail; 7 controls pass.
  • Final full suite: 250 passed, 52 skipped. Existing tests that call printenv use the installed Git for Windows utility on PATH. Package coverage is 88%; subprocess execution is not included in that single-process coverage measurement.
  • Full Ruff lint/format, configured mypy for Python 3.10 through 3.15 with the Linux platform target, native Windows mypy of package/changed test, check-manifest, wheel/sdist and diff checks pass.
  • Focused source checks pass on Windows / CPython 3.11.15, 3.12.10, 3.13.13 and 3.14.0: seven actual child-process checks per interpreter. Three POSIX process checks pass on Linux / CPython 3.10.12, preserving distinct upper/lowercase names. These are not full suites on other interpreters.

Checked #730/#742 (effective PATH lookup) and #749 (failed lookup fallback). This fixes key canonicalization before that lookup; it does not change fallback or PATHEXT behavior. The issue was reported with an independently run native Windows reproduction before editing.

AI assistance: OpenAI Codex (GPT-6) prepared the investigation, implementation and validation under the account owner's contribution task. No production usage or independent human review is claimed.

Hosted validation on 3c0102eaa3fee464421db4ef79f40d89ca5a542e: Run Tests 46327730170 completed successfully, including Ubuntu CPython 3.10–3.15, 3.15t and PyPy 3.11, and native Windows CPython 3.10/3.15.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotenv run ignores mixed-case Path overrides on Windows

1 participant