Package: wl-beta
Version: 2.15.9+0.20130701-6
Severity: important
Tags: patch

The patch 10_ikazuhiro.patch in -6 makes the following change in
elmo-util.el:

 (defsubst elmo-delete-cr-region (start end)
   "Delete CR from region."
-  (save-excursion
-    (goto-char start)
-    (while (search-forward "\r\n" end t)
-      (replace-match "\n")) ))
+  (decode-coding-region start (or end (point-max)) 'raw-text-dos))

And later:

 (defun elmo-delete-cr (string)
-  (save-match-data
-    (elmo-set-work-buf
-      (insert string)
-      (goto-char (point-min))
-      (while (search-forward "\r\n" nil t)
-       (replace-match "\n"))
-      (buffer-string))))
+  (decode-coding-string string 'raw-text-dos))

This is problematic because decode-coding-{region,string} won't strip
CRs with raw-text-dos unless inhibit-eol-conversion is nil (see
decode_coding_raw_text() in coding.c).  And this variable is documented
in the manual as a preference and may well have been changed from the
default nil:

  Emacs recognizes which kind of end-of-line conversion to use based on
  the contents of the file: if it sees only carriage-returns, or only
  carriage-return linefeed sequences, then it chooses the end-of-line
  conversion accordingly.  You can inhibit the automatic use of
  end-of-line conversion by setting the variable `inhibit-eol-conversion'
  to non-`nil'.  If you do that, DOS-style files will be displayed with
  the `^M' characters visible in the buffer; some people prefer this to
  the more subtle `(DOS)' end-of-line type indication near the left edge
  of the mode line (*note eol-mnemonic: Mode Line.).

So now, if inhibit-eol-conversion is non-nil, elmo will cache the
message with the CRs and various things that parse the stored message
using regexps and expect headers to end in LFs will break.  (I first
noticed this when mmbuffer-parse-multipart in flim/mmbuffer.el started
producing message/x-broken messages).

The fix seems trivial:

(defsubst elmo-delete-cr-region (start end)
  "Delete CR from region."
  (let ((inhibit-eol-conversion nil))
    (decode-coding-region start (or end (point-max)) 'raw-text-dos)))

(defun elmo-delete-cr (string)
  (let ((inhibit-eol-conversion nil))
    (decode-coding-string string 'raw-text-dos)))


Thanks,

-- 
Stelios.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to