Binary files modified on Windows: 0a exchanged with 0d0a

Hi, I am trying to setup CircelCI for Windows and noticed an unexpected failure of some of the tests caused by modification of our binary files by CircleCI.
(Couldn’t find any information of that kind anywhere on the site, maybe due to incorrect keywords search, so logging.)

Compare results from the same job run on Linux and Windows.

Provided script checks out the code and prints hex contents of several binary files containing character 0a as one of the first 2 bytes.
Content of these files appears to be different on Linux (expected) and Windows (unexpected).

Compare output from xxd hexcheck/10a.part:


00000000: 0a0a 0a0a 0a0a 0a0a 0a0a


00000000: 0d0a 0d0a 0d0a 0d0a 0d0a 0d0a 0d0a 0d0a
00000010: 0d0a 0d0a

It seems like CircleCI exchanges 0a with 0d 0a newline characters when 0a happens somewhere at the start of the file. (Exact logic is unclear. Substitution happens in all provided tests but “hex 3 bytes” and “hex 2 and 4”. Files where first 0a happens on byte 3 or later seem not to be affected.)
Do not know if the same/similar issue would happen on MacOS.

This behavior was quite unexpected. Would it be possible to do something about it?

1 Like

Hi achaikou,

This is probably caused by git trying to do the right thing with line-ending when you checkout code:

In one of our jobs (specifically the one that we use for testing our internal build agent on Windows) we do the following before checkout:

      - run: git config --global core.autocrlf false
      - checkout

Can you try that and see if it fixes the issues?


Thank you Marc!
Indeed, it is caused by git default newline settings.
Your suggested approach works just fine.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.