On Sat, Oct 03, 2026 at 10:34:56PM +0200, Patrice Dumas wrote: > On Sat, Oct 03, 2026 at 10:27:03AM -0700, Per Bothner wrote: > > > > > > On 10/3/26 09:13, Patrice Dumas wrote: > > > 1) input > > > > > > How should CRLF be treated in input for native Windows? Should they be > > > treated as a logical end of line (the same as a LF in posix systems), or > > > as a CR character followed by an end of line? > > > > This should be handled the same on both Windows and non-Windows: > > CRLF is equivalent to LF. Always, as long as we're talking about "text > > files" > > - which includes anything you would edit with a text editor. (Binary files > > and > > network protocols can and should be stricter.) > > Actually I found a thread where the consensus was that LF was better, > but CRLF should be accepted on Windows too: > > https://lists.gnu.org/archive/html/bug-texinfo/2015-09/msg00118.html > > Accepting CRLF and LF on any platform is not far from that. > > (I had seen previous threads with different conclusions, I think, but > this is the more recent, I believe).
We don't need to support input files with CRLF line endings except perhaps on MS-Windows-like platforms, despite the certainty expressed in the message you are replying to. It's a unnecessary burden that we are free to reject. It's possible that we support these line endings in an incomplete way and then there are unexpected errors that are tricky to investigate. For example, I remember once that a user had a problem with an "@" continuation character on a @deffn line failing to work because that part of the file had CRLF line endings, so texi2any was seeing @^M instead of @<newline>. Generally files with CRLF line endings should be discouraged on GNU/Linux systems as they are likely to break in unexpected and confusing ways. Files with CRLF line endings are not guaranteed to work the same as those with LF line endings on Unix-like systems. For example: $ printf '1 a\r\n2 a\r\n' 1 a 2 a $ printf '1 a\r\n2 a\r\n' | grep 'a$' $ echo $? 1 Here grep fails to detect an 'a' at the end of a line in input with CRLF line endings. The example of the "diff" program was already given, with the --strip-trailing-cr option (on GNU diff at least) being necessary to treat CRLF line endings the same as LF line endings. The claim that files should CRLF line endings should always be treated the same as LF line endings appears to be based on wishful thinking rather than reflecting common practice. I remember proposing that texi2any should always strip trailing whitespace from lines to match the behaviour of TeX, but you (Patrice) didn't like the idea (private mail, 2023-02-16). > > -- > Pat >
