Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ script/pre-commit export-ignore
# Scorecard entirely
# no export of website-specific content
doc/talk export-ignore
# these Windows batch scripts intentionally use CRLF line endings, do not
# flag the CR as a trailing whitespace error
script/INSTALL.bat whitespace=cr-at-eol
script/UNINSTALL.bat whitespace=cr-at-eol
26 changes: 25 additions & 1 deletion .github/workflows/windows_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,31 @@ jobs:
run: |
jar xvf %DIST_WIN%.zip
cd %DIST_WIN%
INSTALL.bat
:: replace (rather than extend) the inherited PATH with a
:: controlled value that is still past the legacy 1024-character
:: limit of the 'setx' tool previously used here, to simulate a
:: large pre-existing PATH such as found in a Visual Studio
:: Developer Prompt (see GH-654), while staying safely under the
:: 8191-character command line length limit of cmd.exe
setlocal enabledelayedexpansion
set "PATH=%SYSTEMROOT%\system32;%SYSTEMROOT%"
for /L %%i in (1,1,50) do set "PATH=!PATH!;C:\dummy-path-segment-%%i"
set "PATH=!PATH!;C:\marker-end-of-long-path"
call INSTALL.bat
- name: Check persisted PATH is not truncated
shell: cmd
run: |
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH > persisted-path.txt
%SYSTEMROOT%\system32\find /i "marker-end-of-long-path" persisted-path.txt >nul
if errorlevel 1 (
echo "persisted system PATH truncated: marker entry not found"
exit /b 1
)
%SYSTEMROOT%\system32\find /i "%MODULE_DIR%" persisted-path.txt >nul
if errorlevel 1 (
echo "installation 'bin' directory not found in persisted system PATH"
exit /b 1
)
- name: Test Modules installation
shell: cmd
run: |
Expand Down
1 change: 1 addition & 0 deletions .hunspell.en.dic
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ setState
setenv
setgid
setq
setx
severities
sexualized
sgr
Expand Down
6 changes: 6 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ Modules 5.7.0 (not yet released)
white matte color instead of black.
* Doc: document Windows Terminal profile setup as an alternative way to
initialize Modules on Windows without an install script. (fix issue #634)
* Install: use ``reg add`` instead of ``setx /M`` to persist the system-wide
``PATH`` environment variable in :file:`INSTALL.bat` and
:file:`UNINSTALL.bat`, as ``setx`` silently truncates the value it writes
to 1024 characters, which could corrupt the system ``PATH`` when installing
from a shell with an already long inherited ``PATH`` (e.g. a Visual Studio
Developer Prompt). (fix issue #654)


.. _5.6 release notes:
Expand Down
5 changes: 4 additions & 1 deletion doc/source/devel/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ on Windows:
<https://www.bawt.tcl3d.org/>`_), built via ``make dist-win`` and
installed/tested/uninstalled through the generated
:file:`INSTALL.bat`/:file:`TESTINSTALL.bat`/:file:`UNINSTALL.bat`
scripts, driven from a ``cmd`` shell.
scripts, driven from a ``cmd`` shell. Before installing, the inherited
``PATH`` is padded past the legacy 1024-character limit of the
``setx`` tool (mimicking a Visual Studio Developer Prompt) to guard
against the persisted system ``PATH`` getting silently truncated.
``native-pwsh``
Same native Windows install, but through the PowerShell variant
(:file:`INSTALL_PWSH.bat`/:file:`TESTINSTALL_PWSH.ps1`).
Expand Down
4 changes: 3 additions & 1 deletion script/INSTALL.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ set FIND=%SYSTEMROOT%\system32\find
echo %PATH% | %FIND% /i "%binpath:"=%">nul || set "NEWPATH=%binpath%;%PATH%"
if not "%NEWPATH%" == "" (
set "PATH=%NEWPATH%"
setx /M PATH "%NEWPATH%"
:: 'reg add' is used instead of 'setx /M' as the latter silently
:: truncates the value it persists to 1024 characters
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%NEWPATH%" /f
)
if errorlevel 1 ( exit /b 3 )

Expand Down
4 changes: 3 additions & 1 deletion script/UNINSTALL.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ setlocal enableextensions enabledelayedexpansion
set "NEWPATH=!PATH:%binpath%;=!"
if not "%NEWPATH%" == "%PATH%" (
set "PATH=%NEWPATH%"
setx /M PATH "%NEWPATH%"
:: 'reg add' is used instead of 'setx /M' as the latter silently
:: truncates the value it persists to 1024 characters
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PATH /t REG_EXPAND_SZ /d "%NEWPATH%" /f
)
if errorlevel 1 ( exit /b 1 )

Expand Down
Loading