-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
all: Figuring out line-endings for Windows #9281
Comments
OK. Found the culprit. cmd/gc/lex.c:getlinepragma() couldn't handle crlf EOL. |
I fixed this issue, but get tired of fixing other test failures due to changes in EOL in testdata. Here is part of the test log:
Could we please just require every windows user to set core.autocrlf to input or I'm pretty sure that even if we fixed all these test failures, the sub-repos also |
No-one should set I'd be in favour of forcing |
@dsymonds could we just create a .gitattributes file in the root directory of each branch: Is there any better way to force this? (It seems some older version of msysgit defaults core.autocrlf to true) |
I would be fine with that (though it probably really only needs to be on |
That's an external-facing bug. |
To be more explicit, if I were to check in a |
I agree with both @rsc and @dsymonds: Russ thinks the compiler & tools should deal with other user's CRLF line endings, if they choose to use them. David thinks that the Go project (for our own files) should enforce Unix line endings, which means our unit tests can assume that files are disk are exactly as they were when they were submitted. |
I don't have fixate. do it as you are thinking as best. 👍 |
@dsymonds, we didn't get any complaints while using hg, which keeps line |
To summarize, when the tree reopens (or now? @bradfitz, do you want me to
|
Please note that don't set eol=lf to all of files. :)
|
Minux, you can send CLs to fix Windows now. The reason the tree is frozen right now is just to get all our infrastructure updated to the new world (git + gerrit), but this is part of that. |
@mattn, why does that matter? We never had problems with *.bat or *.cmd files in Mercurial having Unix line endings, did we? I don't want to make exceptions based on filename. |
Right now, all the .bat files are using \n as EOL, and it's working fine, (In fact, all the files tracked in the repository are using \n as EOL.) |
Windows doesn't handle UNIX fileformat in batch file correctly. http://stackoverflow.com/questions/486380/problem-with-windows-batch-file-on-windows-7 |
If we find a case where Windows can't deal with a unix-line-ended batch file, we'll change it in the version control system to Windows line endings. But so far we've been okay. |
Okay! Do it please. |
Windows does have a bug dealing with batch files in \n EOL style, however, If you run the batch file using cmd.exe, it should work fine. I don't think user should double-click all.bat, as when the build fails, |
build succeeded! cool! 👍 http://build.golang.org/ |
with .gitattributes having * eol=lf the png and jpg files get mangled. My steps are: git clone https://github.com/golang/go.git and now I see tons of: Which of course prevents pulls. What's the remedy? |
Actually what fixes it for me is replacing "* eol=lf" with "text eol=lf". Let me send a PR unless someone pick it up. |
Chaning "* eol=lf" to "text eol=lf" fixes the binary file problem, but then I'm afraid we will have to explicit set -text for certain binary files in Perhaps the right way is to make cmd/dist brak when it sees core.autocrlf |
@minux, yes, let's just be strict. git should operate in everything-is-binary-files-always mode and if we detect that they're trying to use autocrlf with the Go repos, then we should fail to run the build. It could also be in make.bat if that's easier. |
How about this?
|
What does that mean? Everything is not text? If that does what I wanted above (treat everything as binary, always), that's fine. |
Yeah, that means everything is not text, and I just checked on Windows, it However, the whole system is not that simple. see To recap our requirements:
That post recommends setting: btw, the new system works from git 1.7.2 and above, so we need to require |
Sherman, no problem. |
golang.org/x/text is still broken http://build.golang.org/log/f6a9e9bc43b2156709560ce3c8fd2cbced3fd818 ok golang.org/x/text/cases 2.521s and golang.org/x/net is broken http://build.golang.org/log/2afb4b91e984f5f4f9ef68db8d2977d47ba87c25 ok golang.org/x/net/context 2.838s Both can be fixed by adding .gitattributes. Is that what we want to do? What about other repos? Should we update others on as needed basis? Alex |
golang.org/x/tools needs .gitattributes too. Alex |
Alex, all yours. |
Should we just add .gitattributes to each of the sub-repos? |
Yes. |
Cool. I will do that. |
I have updated all repos listed on http://build.golang.org. |
This is something that worked fine in 1.4 that is now broken in 1.5 (b2) for me.
I'm kind of dumbstruck that the go compiler is getting confused about simple line endings when reading .go files. It doesn't seem to care at all about user source line endings. |
@pbennett This issue is closed. If you are having trouble with 1.5, please open a new issue with a description of how to reproduce the problem. Thanks. |
|
Fixes golang#9281 Change-Id: Iae395834b5eb0d5709a22ac78949d274fed77c93 Reviewed-on: https://go-review.googlesource.com/2078 Reviewed-by: Minux Ma <minux@golang.org>
Fixes golang#9281 Change-Id: I15c448ec0fe8155b5e30e0aabdb48ea1d8504042 Reviewed-on: https://go-review.googlesource.com/2073 Reviewed-by: Minux Ma <minux@golang.org>
Fixes golang#9281 Change-Id: Ia4bb2e9af9f660f42202bb1d07920578cd0f9c3e Reviewed-on: https://go-review.googlesource.com/2076 Reviewed-by: Minux Ma <minux@golang.org>
Fixes golang#9281 Change-Id: If3aad25a9bc24f04d604a534bef4f2e08ce00ffc Reviewed-on: https://go-review.googlesource.com/2070 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
I have core.autocrlf set to yes, and can reproduce this problem.
http://build.golang.org/log/c34d0dabf9c4e187a2120709e7b1e61541ad9e0a
The text was updated successfully, but these errors were encountered: