Re: tests fail on windows with default git settings
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org,
Dave Page <dpage@pgadmin.org>
Date: 2024-07-09T10:26:12Z
Lists: 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
Commits
-
Use diff --strip-trailing-cr in pg_regress.c
- 291c42074721 18.0 landed
-
Use diff's --strip-trailing-cr flag where appropriate on Windows
- 4506d18a9891 17.0 landed
- 628c1d1f2c82 18.0 landed