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

From Andrew Dunstan
Subject Re: tests fail on windows with default git settings
Date
Msg-id 43a33919-04a3-4a57-afcb-77d5a55ab7ed@dunslane.net
Whole thread Raw
In response to Re: tests fail on windows with default git settings  (Andres Freund <andres@anarazel.de>)
Responses Re: tests fail on windows with default git settings
List pgsql-hackers


On 2024-07-08 Mo 5:44 PM, Andres Freund wrote:
What I suggest (see attached) is we run the diff command with
--strip-trailing-cr on Windows. Then we just won't care if the expected file
and/or the output file has CRs.
I was wondering about that too, but I wasn't sure we can rely on that flag
being supported...


Well, my suggestion was to use it only on Windows. I'm using the diffutils from chocolatey, which has it, as does Msys2 diff. Not sure what you have in the CI setup.

Not sure what the issue is with pg_bsd_indent, though.
I think it's purely that we *read* with fopen("r") and write with
fopen("wb"). Which means that any \r\n in the input will be converted to \n in
the output. That's not a problem if the repo has been cloned without autocrlf,
as there are no crlf in the expected files, but if autocrlf has been used, the
expected files don't match.

It doesn't look like it'd be trivial to make indent remember what was used in
the input. So I think for now the best path is to just use .gitattributes to
exclude the expected files from crlf conversion.  If we don't want to do so
repo wide, we can do so just for these files.


either that or we could use the --strip-trailing-cr gadget here too.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Address the -Wuse-after-free warning in ATExecAttachPartition()
Next
From: Bertrand Drouvot
Date:
Subject: Re: Restart pg_usleep when interrupted