install: use reg add to avoid setx truncating Windows PATH - #667
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 sessionsreg addon the same registry key, which has no such limit and requires the same administrator privilege setx already neededFixes #654