all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shannon Sterz" <s.sterz@proxmox.com>
To: "Samuel Rufinatscha" <s.rufinatscha@proxmox.com>,
	<pbs-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox] fix #7814: send-mail: normalize LF line endings to CRLF endings
Date: Tue, 20 Oct 2026 12:23:16 +0200	[thread overview]
Message-ID: <DM9LB74IG3U0.3952QO9QQ3RG1@proxmox.com> (raw)
In-Reply-To: <ae6d603d-59a6-4d66-9bef-5336bbf7f6c2@proxmox.com>

On Tue Oct 20, 2026 at 11:50 AM CEST, Samuel Rufinatscha wrote:
> On 10/20/26 9:56 AM, Shannon Sterz wrote:
>> On Mon Oct 19, 2026 at 5:49 PM CEST, Samuel Rufinatscha wrote:
>>> Hi Shannon,
>>>
>>> I ran some additional tests, which passed. One note/question regarding
>>> the base64 path:
>>>
>>> Removing \r before base64 encoding changes an valid \r\n into \n after
>>> decoding but if I understand correctly previously it would have
>>> preserved \r\n (as of no normalization).
>>>   From the commit message I understand that removing CR before encoding
>>> is intentional but is changing valid CRLF intentional here too?
>>
>> i deemed a reasonable trade-off as stripping only if no \n follows would
>> have increased complexity quite a bit. note that i can't do the
>> `replace("\n", "\r\n")` trick there as that would transform bare `\n` to
>> CRLF. bare `\n` was extensively tested across multiple MUAs and free
>> mail providers (gmail, outlook, etc.), though, so i wanted to err on the
>> side of caution. since this was reported bug i wanted to give a
>> solution that should work sooner than later.
>>
>> however, since this has been dragged out already, i can eventually get
>> around to do another round of testing with just replace LF with CRLF
>> too. if you are aware of an rfc or best practice on what to do in these
>> cases, i'd appreciate any input, though.
>>
>> i can also provide a commit message that is a bit more telling when it
>> comes to this case in particular.
>>
>
> thanks for the explanation Shannon, make sense to me!
>
> according to RFC 2045 [0] (see 6.8 on page 25), if we would strictly
> follow that, it seems line breaks must be converted to CRLF before
> base64 encoding:
>
> "In particular, text line breaks must be converted into CRLF sequences
> prior to base64 encoding"
>
> i understand keeping the existing LF behavior for compatibility is
> good, also since this behavior is tested. so it makes sense for me to
> preserve this.
>
> regarding CRLF to LF before encoding, i think it would make sense
> to preserve CRLF too, as this was carried over previously and was in
> line with the RFC. alternatively, if I think for now it would be
> sufficient to note this case in the commit message.
>
> [0] https://www.rfc-editor.org/rfc/rfc2045#section-6.8

seems i missed, that so this clarifies how to handle this for the body
of mime messages at least. i'll send a patch that normalizes according
to that rfc then. imo, being standards compliant is preferable as it
usually gives the widest set of compatibility. thanks!

for headers it seems that 2047 only specifies that the encoding should
be identical to 2045 [1]. so I suppose `.replace("\r",
"").replace("\r\n", "")` should be fine there too. i'll update the patch
and add a test for these.

thanks for noticing and the input! :)

[1]: https://www.rfc-editor.org/info/rfc2047/#section-4.1




  reply	other threads:[~2026-10-20 10:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 14:01 [PATCH proxmox] fix #7814: send-mail: normalize LF line endings to CRLF endings Shannon Sterz
2026-07-30 14:02 ` Shannon Sterz
2026-07-31  6:54 ` Lukas Wagner
2026-10-07 13:47 ` Shannon Sterz
2026-10-19 15:49 ` Samuel Rufinatscha
2026-10-20  7:56   ` Shannon Sterz
2026-10-20  9:50     ` Samuel Rufinatscha
2026-10-20 10:23       ` Shannon Sterz [this message]
2026-10-20 14:36 ` superseded: " Shannon Sterz
  -- strict thread matches above, loose matches on Subject: below --
2026-07-14  8:47 Shannon Sterz
2026-07-28 15:32 ` Shannon Sterz
2026-07-29  8:18 ` Lukas Wagner
2026-07-30 14:00   ` Shannon Sterz
2026-07-30 14:02 ` Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM9LB74IG3U0.3952QO9QQ3RG1@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=s.rufinatscha@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal