
Hi,
The test runs the mysql client program interactively (in a terminal), this causes those carriage-return to appear in the output due to PTY or whatever reason. So yes, those carriage-returns in the .result file are "intentional" in the sense that the test as written does not work without them.
Thanks for the explanation that these line endings indeed are intentional.
Firstly, I cannot use 'patch' to remove Windows line endings. I can't even use it to modify that file due to git attributes or patch itself mangling on them (e.g. https://salsa.debian.org/otto/mariadb-server/-/jobs/7569516). I didn't manage to fully debug which step exactly cleans them away and from what file.
patching file mysql-test/main/mysql-interactive.result Hunk #1 FAILED at 10 (different line endings).
This looks like the patch is incorrect, ie. that the carriage-returns in the patch file are not matching the actual file.
This random googled answer suggests it's something with quilt, and has some suggested solution that may or may not work for you depending on how you produced the patch:
https://unix.stackexchange.com/questions/793759/apply-debian-quilt-patch-on-...
Try opening the patch file and the file mysql-test/main/mysql-interactive.result in an editor that shows carriage-returns, and check that the line endings in the two file match.
The patch does not apply because the context snippet has the line endings cleaned before dpkg-source runs. Editing the patch is not a problem, but ensuring end-to-end that both git and patch/quilt treat the patch file as a binary file is the problem. I can locally add as much as I want .git/attributes:debian/patches binary and run quilt with --binary, but I can't really find any sensible way to put it permanently in the Debian packaging config. As the upstream source is now confirmed to be intentionally a binary file, I will just disable the test and stay away from trying to patch binary test result files.