From 573f7bf4cd72fc5ca0be324208f202c551c4dc26 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Fri, 17 Feb 2023 07:01:25 -0500 Subject: [PATCH] Windows: enforce carriage return for .bat files (#35514) Batch scripts in general will not function without carriage return line endings on Windows. We rely on these scripts to support cmd, so we should not allow these scripts to be converted to lf. Note: Windows 11 supports lf line endings due to the use of Windows Terminal. Once support for Windows 10 is dropped, this change can be reverted. --- .gitattributes | 1 + bin/spack.bat | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 5299044761..6dee4b041c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ *.py diff=python *.lp linguist-language=Prolog lib/spack/external/* linguist-vendored +*.bat text eol=crlf \ No newline at end of file diff --git a/bin/spack.bat b/bin/spack.bat index 073f778c34..310b59506c 100644 --- a/bin/spack.bat +++ b/bin/spack.bat @@ -226,7 +226,7 @@ for %%Z in ("%_pa_new_path%") do if EXIST %%~sZ\NUL ( exit /b 0 :: set module system roots -:_sp_multi_pathadd +:_sp_multi_pathadd for %%I in (%~2) do ( for %%Z in (%_sp_compatible_sys_types%) do ( :pathadd "%~1" "%%I\%%Z"