Subject: bug#870: Repeatable instance of bug#870

From: "Juanma Barranquero" <[email-masked]>
Date: Mon, 5 Jan 2009 06:03:36 +0100

Today, I've been finally able to create a repeatable test case for
bug#870, "Missing ^J in ChangeLog".

The bug manifests itself as one or more ^J chars missing when reading
a text file. AFAIK, it has only happened with ChangeLogs, and just to
a few Windows users (not unexpectedly, as we typically handle much
more CRLF files than people on other systems).

On my setup, the bug can be repeated at will by doing:

   emacs -Q --eval "(desktop-save-mode 1)" ChangeLog.870
   C-x C-f
   y <RET>    ; to save the desktop when asked
   emacs -Q --eval "(desktop-read)"
   C-s C-q C-M

After that, the cursor will be over a ^M char, the remnant of a CRLF
pair whose ^J has disappeared.

If before restarting Emacs you edit .emacs.desktop and remove
"(buffer-file-coding-system . utf-8-dos)" from the ChangeLog.870
entry, the bug does not happen.

The missing ^J is exactly at position #x8000 of the ChangeLog.870
file. If you do remove a character from the file and repeat the test,
the problem does not happen at position #x8000, but another instance
of the same bug does happen at position #x38007. That seems to
indicate some kind of trouble with a 32 KiB buffer.

I'm attaching a bzipped copy of ChangeLog.870.

Any help in debugging this bug (or even a patch fixing it ;-) will be
much appreciated.

    Juanma