Skip to content

dotenv run ignores mixed-case Path overrides on Windows #761

Backlog

Description

@Gambit-Checkmate

On native Windows, .env environment names differing only by case do not override the same inherited variable in dotenv run's effective environment. In particular, Path and path do not participate in the PATH lookup added by #742, although Windows environment names are case-insensitive.

Reproduced on main 4fbc6ff, Windows / CPython 3.13.13:

  1. Put a harmless executable with a unique name in a tools directory absent from the parent PATH (I copied cmd.exe to dotenv-case-probe.exe).
  2. Write PATH='C:/path/to/tools' in .env. dotenv run -- dotenv-case-probe /c echo PATH_CASE_OK prints the marker and exits 0.
  3. Change only the key to Path, then to path. Both calls instead exit 1 with Command not found: dotenv-case-probe.

run_command copies os.environ (which normalizes names to uppercase on Windows), then updates an ordinary case-sensitive dictionary with the .env mapping. This leaves both PATH and Path in that dictionary, and cmd_env.get("PATH") still returns the inherited value. Windows can resolve the duplicate names when creating the child process, but that happens after this explicit executable lookup.

I checked #373/#730/#742 and #749. They address executable resolution and a failed lookup's fallback, not environment-key casing. I plan to normalize the added names only in the Windows branch, retain case-sensitive names on POSIX, and add real-process regressions for mixed-case PATH/variables and --no-override controls. The isolated native Windows process reproduction has been run; no production usage is claimed. AI assistance: OpenAI Codex.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions