bounce/forward not working due to CR at line end

Kai Harries kai.harries at gmail.com
Fri Nov 17 10:16:07 PST 2017


David Bremner <david at tethera.net> writes:

> Kai Harries <kai.harries at gmail.com> writes:
>
>> David Bremner <david at tethera.net> writes:
>>
>>> Kai Harries <kai.harries at gmail.com> writes:
>>>
>>>> David Bremner <david at tethera.net> writes:
>>>>
>>>>> During off-list discussion, Kai mentioned id:87a7zsm5ol.fsf at gmail.com as
>>>>> a message that he cannot bounce (and also not forward?). For me this
>>>>> forwards fine, but does not bounce because it has a corrupted Cc header,
>>>>> and my MTA rejects it.  That doesn't sound related to the original
>>>>> problem report (nothing about line endings).
>>>>
>>>> Can you please evaluate the following on your system:
>>>>
>>>>   (call-process "notmuch" nil t nil "show" "--format=raw" "id:87a7zsm5ol.fsf at gmail.com")
>>>>
>>>> If I do this on my system, then the text that is inserted into the
>>>> buffer has ^M (CR) at the line endings. Is this expected?
>>>
>>> No ^M line endings for me. Can you check the file on disk? Maybe "od -a"
>>> lacking a better idea.
>>
>> `od -a` does also show that the lines are ending with 'cr' and 'nl'
>> this is correct according to RFC 2822 [1].
>
> That's not so clear. RFC2822 is explicitely not about disk storage; see
> the Scope paragraph of RFC2822 or RFC522. I think most peoples unix mail
> delivery agents use line feeds, otherwise more people would be having
> problems resending mail.  See e.g. point 2 in
>
>      https://www.exim.org/exim-html-current/doc/html/spec_html/ch-message_processing.html
>
> Be that as it may, apparently your system is using CRLF.

I am using gmailier [1] to sync my maildir. For testing purpose I just
installed offlineimap and in contrast to gmailiier the mails on
disk have no CRLF. 

>> According to this [2] Emacs normally converts line endings to only 'nl'
>> (newline) when opening a DOS file. This works on my system, if I open the
>> file from disk no carriage-return (^M) is shown.
>>
>> Not working is inserting the output of `notmuch show` into a buffer. If
>> I do this, then the carriage-return (^M) is shown.
>
> Yes, notmuch-show-resend-message uses notmuch-show-view-raw-message,
> which intentionally turns off any conversion
>
>>
>> David, I assume your system is also a Linux, does
>>
>>   notmuch show --format=raw id:1472041345236.7014 at de.bosch.com | od -a
>>
>> also show 'cr' and 'nl' as line ending?
>
> No, I don't have carriage returns in my actual files on disk, and
> consequently not in the output of notmuch show --format=raw.
>
> I suspect notmuch is mostly fine with CRLF line endings, due to mainly
> passing everything through gmime. But in the case of notmuch show
> --format=raw, this is not the case.
>
> I did confirm that adding CRLF line endings to an existing mail file
> causes the symptoms you originally described.
>
> I'm still not sure the best place to fix this; I'm pretty sure upstream
> emacs won't accept your change (or equivalent) to mime-to-mml.
>
> d

I am thinking about filing a ticket against gmailier because storing the
emails with CRLF on a *nix is at least surprising.

[1] https://github.com/gauteh/gmailieer


More information about the notmuch mailing list