Skip to content

Commit cd2cd4c

Browse files
committed
Auto merge of #62564 - Mark-Simulacrum:azure-line-endings, r=pietroalbini
Ensure that checkout is with \n line endings During installation of mingw, at least, the git directories change, so we need to reset the core.autocrlf config to false. Once we finish checking out submodules, check that the line endings are \n and not \r\n. Artifacts were built via the last try on #62545; I've manually confirmed that `install.sh` appears to no longer have `\r\n` line endings. Fixes #62276.
2 parents c6a9e76 + df725c2 commit cd2cd4c

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.azure-pipelines/steps/install-windows-build-deps.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ steps:
99
displayName: "Ensure build happens on C:/ instead of D:/"
1010
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
1111

12+
- bash: git config --replace-all --global core.autocrlf false
13+
displayName: "Disable git automatic line ending conversion (on C:/)"
14+
1215
# Download and install MSYS2, needed primarily for the test suite (run-make) but
1316
# also used by the MinGW toolchain for assembling things.
1417
#

.azure-pipelines/steps/run.yml

+31
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ steps:
1212
# Azure's Windows image. Having the conversion enabled caused regressions both
1313
# in our test suite (it broke miri tests) and in the ecosystem, since we
1414
# started shipping install scripts with CRLF endings instead of the old LF.
15+
#
16+
# Note that we do this a couple times during the build as the PATH and current
17+
# user/directory change, e.g. when mingw is enabled.
1518
- bash: git config --global core.autocrlf false
1619
displayName: "Disable git automatic line ending conversion"
1720

@@ -70,6 +73,14 @@ steps:
7073
displayName: Enable IPv6
7174
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
7275

76+
# Disable automatic line ending conversion (again). On Windows, when we're
77+
# installing dependencies, something switches the git configuration directory or
78+
# re-enables autocrlf. We've not tracked down the exact cause -- and there may
79+
# be multiple -- but this should ensure submodules are checked out with the
80+
# appropriate line endings.
81+
- bash: git config --replace-all --global core.autocrlf false
82+
displayName: "Disable git automatic line ending conversion"
83+
7384
# Check out all our submodules, but more quickly than using git by using one of
7485
# our custom scripts
7586
- bash: |
@@ -84,6 +95,26 @@ steps:
8495
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
8596
displayName: Check out submodules (Windows)
8697

98+
# See also the disable for autocrlf above, this just checks that it worked
99+
#
100+
# We check both in rust-lang/rust and in a submodule to make sure both are
101+
# accurate. Submodules are checked out significantly later than the main
102+
# repository in this script, so settings can (and do!) change between then.
103+
#
104+
# Linux (and maybe macOS) builders don't currently have dos2unix so just only
105+
# run this step on Windows.
106+
- bash: |
107+
set -x
108+
# print out the git configuration so we can better investigate failures in
109+
# the following
110+
git config --list --show-origin
111+
dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
112+
endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
113+
# if endings has non-zero length, error out
114+
if [ -n "$endings" ]; then exit 1 ; fi
115+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
116+
displayName: Verify line endings are LF
117+
87118
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
88119
# images, etc.
89120
- bash: |

0 commit comments

Comments
 (0)