Skip to content

install: use reg add to avoid setx truncating Windows PATH - #667

Merged
xdelaruelle merged 1 commit into
mainfrom
issue654
Aug 4, 2026
Merged

install: use reg add to avoid setx truncating Windows PATH#667
xdelaruelle merged 1 commit into
mainfrom
issue654

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Summary

  • INSTALL.bat/UNINSTALL.bat persisted the system-wide PATH with setx /M, which silently truncates the value it writes to 1024 characters; installing from a shell with an already long inherited PATH (e.g. a Visual Studio Developer Prompt) could corrupt the persisted PATH and drop entries needed to start cmd.exe/powershell.exe in later sessions
  • Switch to reg add on the same registry key, which has no such limit and requires the same administrator privilege setx already needed
  • TESTINSTALL.bat now checks the bin directory against the persisted registry PATH instead of only the current session's PATH
  • native-cmd CI job now pads the inherited PATH past 1024 characters before installing and verifies the persisted PATH isn't truncated, to catch regressions here automatically

Fixes #654

INSTALL.bat and UNINSTALL.bat persist the system-wide PATH with
'setx /M', which silently truncates the value it writes to 1024
characters. When installing from a shell with an already long
inherited PATH, such as a Visual Studio Developer Prompt, this drops
the tail of the persisted PATH, which can remove entries required to
even start cmd.exe or powershell.exe in a later session. Use 'reg
add' on the same registry key instead, which has no such limit and
requires the same administrator privilege setx already needed.

Mark these Windows batch scripts, which intentionally carry
carriage-return line endings, with the cr-at-eol whitespace attribute
so the pre-commit hook stops flagging their line endings as trailing
whitespace.

Extend the native-cmd CI job to replace the inherited PATH with a
controlled value past the legacy 1024-character limit before
installing, then check the persisted registry PATH afterward, so a
regression here gets caught automatically. The replacement keeps the
length controlled and safely under the 8191-character command line
length limit of cmd.exe, rather than extending the runner's own
already large inherited PATH and risking hitting that separate limit.

Fixes #654

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xdelaruelle
xdelaruelle merged commit 9a4f78c into main Aug 4, 2026
37 checks passed
@xdelaruelle
xdelaruelle deleted the issue654 branch August 4, 2026 17:35
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.

Install scripts will violate system environment variable PATH in VS Developer Prompt/PowerShell

1 participant