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

some tests fail on Windows if source files are checked out with CRLF line endings #9472

Closed
scabug opened this issue Sep 16, 2015 · 9 comments

Comments

@scabug
Copy link

scabug commented Sep 16, 2015

Because of #3101, some triple-quoted strings in the source code for Scala have different line endings depending on how the source files are checked out of version control. This then causes failures because the additional CR characters cause (e.g.) String.equals or String.contains checks to fail.

Affected files include:

  • test/junit/scala/io/SourceTest.scala
  • test/junit/scala/reflect/internal/PrintersTest.scala
  • test/junit/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzerTest.scala
  • test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala
  • test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala
@scabug
Copy link
Author

scabug commented Sep 16, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9472?orig=1
Reporter: @SethTisue
Affected Versions: 2.11.7
See #3101

@scabug
Copy link
Author

scabug commented Sep 16, 2015

@SethTisue said:
See discussion at scala/scala#4744. Currently we are leaning towards simply recommending that people working in the Scala repo on Windows check out source files using LF line endings.

@scabug
Copy link
Author

scabug commented Sep 16, 2015

@retronym said:

 check out source files using LF line endings.

Nitpick: they should checkout with unaltered line endings. Some files in our repo have CRLF line endings:

⚡ file src/compiler/scala/tools/ant/templates/tool-windows.tmpl
src/compiler/scala/tools/ant/templates/tool-windows.tmpl: ASCII English text, with CRLF line terminators

@scabug
Copy link
Author

scabug commented Sep 16, 2015

@som-snytt said:
My aliases on cygwin always included

-Dline.separator=$'\n'

to help mitigate one form of mixed line endings.

@scabug
Copy link
Author

scabug commented Sep 17, 2015

@martijnhoekstra said:
A better solution than to rely on manual instruction could be to change the normalisation in .gitattributes

Currently it has

  • text=auto

which will set all files to auto text, meaning on check out it converts all line endings to core.eol, and on check in convert all line endings to lf. For anyone who has core.eol set to anything but lf that would spell trouble.

I'm no git wizard, but shouldn't changing that line to

  • eol=lf

do the trick? If it does, it seems like a better solution than to tell all windows users to config their core.eol for this repo.

In response to Jasons nitpick: The *-windows.tmpl files (as well as .cmd and .bat) are already set to eol=crlf in .gitattributes

@scabug
Copy link
Author

scabug commented Sep 17, 2015

@SethTisue said (edited on Sep 17, 2015 11:57:56 AM UTC):
Yes, I agree that eol=lf in .gitattributes seems like the way to go. (I have been looking into this as well and arrived at the same conclusion.) I've been waiting to put together a pull request until I can verify that all tests are passing on Windows, so if any additional changes are needed, I can include them too.

@scabug
Copy link
Author

scabug commented Sep 18, 2015

@SethTisue said:
It looks to me like eol=lf supplements rather than replaces text=auto. The former affects working copies, the latter affects commits.

@scabug
Copy link
Author

scabug commented Sep 25, 2015

@SethTisue said:
scala/scala#4770

@scabug scabug closed this as completed Oct 5, 2015
@scabug
Copy link
Author

scabug commented Oct 5, 2015

@SethTisue said:
4770 was merged, but closing this ticket as "wontfix" since the PR doesn't make the tests robust to different eol styles, rather, it attempts to enforce that people have the right style in their checkouts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants