KcFnMi
KcFnMi

Reputation: 6171

Git/Jenkins/Windows (not ordered) line ending issue

I'm playing with a Qt project in Windows. Actually I'm preparing it to build on Linux also. The problem is that the build.sh script (below) inflates 1 byte per line (*) somewhere in the process which makes it fail when it gets executed by the end user.

*I'm comparing the size in the developer machine against the size in the end user machine. Between these, Jenkins (running on Windows) get things from git server and packs a tar.gz file (using cygwin), which the end user gets after all.

#!/bin/bash
qmake Project.pro
make
make clean

How should I approach this issue?

May I provide more information?

Upvotes: 0

Views: 2262

Answers (1)

borancar
borancar

Reputation: 1189

To me it looks like git Jenkins is using on Windows has crlf conversion enabled - it will take Linux line endings \n and convert them to \n\r. The symptom you usually see is

/bin/bash^M: bad interpreter: No such file or directory

You should probably set core.autocrlf = input, or at least prevent automatic conversion on script, binary, archives, etc...

See here for more details: https://help.github.com/articles/dealing-with-line-endings/#platform-all. I know it suggests using core.autocrlf = true for Windows, but you are actually using Cygwin on Windows, and you are packing scripts for Cygwin so you probably want core.autocrlf = input (no conversion).

Upvotes: 1

Related Questions