Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trim each line when printing update reminder #478

Merged
merged 1 commit into from
Aug 19, 2024
Merged

trim each line when printing update reminder #478

merged 1 commit into from
Aug 19, 2024

Conversation

cfbao
Copy link
Member

@cfbao cfbao commented Aug 19, 2024

Why

The update reminder's background area is misaligned on Windows:
image

This is because we didn't account for \r on Windows.
Still a mystery why this only happens with GitHub Actions' build but not with our local builds. Regardless, this fix works with both.

Ticket

https://desire2learn.atlassian.net/browse/VUL-447

@github-actions github-actions bot added language/csharp size/XS A very small PR - good job! labels Aug 19, 2024
@cfbao cfbao marked this pull request as ready for review August 19, 2024 19:19
@cfbao cfbao requested a review from a team as a code owner August 19, 2024 19:19
@cfbao cfbao merged commit df209e7 into main Aug 19, 2024
9 checks passed
@cfbao cfbao deleted the splitline-trim branch August 19, 2024 19:38
@cfbao
Copy link
Member Author

cfbao commented Aug 19, 2024

OMG... I know why.

Which newline string is used (LF vs CRLF) in raw string literals is determined by which one you use in the source file (well... they are "literals").
E.g. given the source code

string s = """
	1
	2
	""";
Console.WriteLine(
	Convert.ToHexString(System.Text.Encoding.UTF8.GetBytes(s))
);

the program will

  • print 310A32 if the file uses LF as newline characters
  • print 310D0A32 if the file uses CRLF as newline characters

On our dev machines, we set core.autocrlf=false in Git and have end_of_line = lf in .editorconfig, so we always have LF as newline characters.
GitHub Actions Windows runners seems to be using core.autocrlf=true, so all source files are cloned with CRLF line endings...(!!!) and hence the executables built has different behaviour, because it doesn't use equivalent source code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/csharp size/XS A very small PR - good job!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants