Skip to content

Support case-insensitive behavior for TaskCtx.env under Windows - #6867

Merged
lefou merged 7 commits into
com-lihaoyi:mainfrom
lefou:tr-taskctx-env-windows
Feb 23, 2026
Merged

lefou merged 7 commits into
com-lihaoyi:mainfrom
lefou:tr-taskctx-env-windows

Conversation

@lefou

@lefou lefou commented Feb 22, 2026

Copy link
Copy Markdown
Member

Fix #4998

@lefou
lefou marked this pull request as draft February 22, 2026 19:56
@gamlerhart

Copy link
Copy Markdown
Contributor

Contra argument:
It is quite easy break builds with Windows <-> Unix-ish OS. Like having a build work by accident on Window but not others.So, I'm not sure if there Mill itself should encourage 'OS-differences'.
We probably never 100% replicate the Windows behavior as well. eg. Windows probably uses the user local for the case-sensitive matching. That local might be different for the JVM process. So, the edge cases now become harder to debug.

So, the alternative to this fix would be to document that Mill is case sensitive in env variables.

@lefou

lefou commented Feb 23, 2026 •

Copy link
Copy Markdown
Member Author

Thing is, JVM already resolves env variable with System.getenv is a case-insensitive manner, since that's what the OS is requiring it. Under Windows, it's legal to use PATH which was defined as Path. That means, Mill can fail in such cases, while probably most other JVM tools will handle it properly by using System.getenv. Detecting those issue, esp. since it's not reproducible when using System.genenv in a small check script or whatever debug mechanism, is really hard.

@lefou
lefou marked this pull request as ready for review February 23, 2026 09:24
@lefou

lefou commented Feb 23, 2026 •

Copy link
Copy Markdown
Member Author

Windows probably uses the user local for the case-sensitive matching.

If you can find source for that or can clarify it is not locale-specific, that would be great.

@lefou
lefou merged commit c10d439 into com-lihaoyi:main Feb 23, 2026
45 checks passed
@lefou
lefou deleted the tr-taskctx-env-windows branch February 23, 2026 10:14
@lefou lefou added this to the 1.1.3 milestone Feb 23, 2026
@gamlerhart

Copy link
Copy Markdown
Contributor

PS: According to Microsoft the order / case-sensitivity for case variable is not local dependent: https://learn.microsoft.com/en-us/windows/win32/procthread/changing-environment-variables

In reality there seem odd edge cases (eg: https://nullprogram.com/blog/2023/08/23/). But that so out of scope of Mills concerns.

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.

Review and potentially fix TaskCtx.env handling when on Windows

3 participants