Skip to content

Conversation

@Lysxia
Copy link
Contributor

@Lysxia Lysxia commented Jul 31, 2025

Fix #648

  • When reading, single \r were read as \n when CRLF decoding is enabled; this bug exists since forever (16 years ago):
    else Yield '\n' i'
  • When writing, \n was not encoded as \r\n when we were at the end of a buffer (bug introduced in Fixed off by one for writeBlocksRaw #590, included in text-2.1.2)

Also improve the "input-output" property test to catch these mistakes (in addition to a dedicated regression test): force the use of a smaller buffer to trigger boundary conditions more easily; explicitly inspect the CRLF encoding.

And to reduce the number of test names, instead of listing all combinations of encodings and buffering modes as individual tests, they are merged into a single test that picks encodings and buffering modes randomly.

@Bodigrim
Copy link
Contributor

@neilmayhew could you please check whether this fixes #648?

@neilmayhew
Copy link

@neilmayhew could you please check whether this fixes #648?

With f662261, my previous example now passes

Thanks for fixing this so promptly!

@Bodigrim Bodigrim merged commit fd9c873 into master Jul 31, 2025
48 of 49 checks passed
@Bodigrim Bodigrim deleted the fix-crlf branch July 31, 2025 21:21
@Bodigrim
Copy link
Contributor

Thanks @Lysxia, awesome! Do you possibly have time to prepare a new text-2.1.3 release?

@Lysxia
Copy link
Contributor Author

Lysxia commented Jul 31, 2025

Yeah I can do that tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRLF with BlockBuffering not always correct

4 participants