tests fail on windows with default git settings - Mailing list pgsql-hackers

From Andres Freund
Subject tests fail on windows with default git settings
Date
Msg-id 20240707052030.r77hbdkid3mwksop@awork3.anarazel.de
Whole thread Raw
Responses Re: tests fail on windows with default git settings
List pgsql-hackers
Hi,

Git on windows defaults to core.autocrlf being enabled. Which means
that a normal git clone will convert all lineendings in text files.

Unfortunately that causes a few tests to fail, at least:
  test_json_parser/001_test_json_parser_incremental
  test_json_parser/003_test_semantic
  pg_bsd_indent/001_pg_bsd_indent

In the case of test_json_parser the problem is that
test_json_parser_incremental.c assumes one can read statbuf.st_size bytes via
fread() - but that doesn't work if the input has crlf inside. Due to the crlf
conversion we reach EOF before we've read statbuf.st_size bytes, triggering an
error.

I suspect the issue with pg_bsd_indent is similar.


Do we want to support checking out with core.autocrlf?  I suspect it might
just take using binary mode in a few more places.


If we do not want to support that, ISTM we ought to raise an error somewhere?
This kind of thing is pretty time consuming to track down, at least for the
windows-noob writing this email.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Paul George
Date:
Subject: Re: Eager aggregation, take 3
Next
From: Tom Lane
Date:
Subject: Re: tests fail on windows with default git settings