GNU bug report logs - #38200
26.2; sendmail.el needlessly munging headers by inserting backslashes

Previous Next

Package: emacs;

Reported by: Ed Sabol <esabol <at> milkyway.gsfc.nasa.gov>

Date: Wed, 13 Nov 2019 22:01:01 UTC

Severity: normal

Tags: fixed

Found in version 26.2

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ed Sabol <esabol <at> milkyway.gsfc.nasa.gov>
Cc: Katsumi Yamaoka <yamaoka <at> jpl.org>, 38200 <at> debbugs.gnu.org
Subject: bug#38200: 26.2; sendmail.el needlessly munging headers by inserting backslashes
Date: Thu, 14 Nov 2019 05:59:37 +0100
Ed Sabol <esabol <at> milkyway.gsfc.nasa.gov> writes:

> 1. Evaluate the following:
> (setq mail-user-agent 'sendmail-user-agent)
> (setq send-mail-function 'sendmail-send-it)

[...]

> "LastName\, FirstName I. \(CODE-999.9\)\[CONTRACTING COMPANY INC\]"
>         <your_email <at> address.com>
>
> It should like like this:
>
> "LastName, FirstName I. (CODE-999.9)[CONTRACTING COMPANY INC]"
>         <your_email <at> address.com>

This isn't due to sendmail or anything, but because

(defcustom rfc2047-header-encoding-alist

[...]

    ("\\(Resent-\\)?\\(From\\|Cc\\|To\\|Bcc\\|\\(In-\\)?Reply-To\\|Sender\
\\|Mail-Followup-To\\|Mail-Copies-To\\|Approved\\)" . address-mime)

and

		    (when (eq method 'address-mime)
		      (rfc2047-quote-special-characters-in-quoted-strings))

> At some point, something in sendmail.el changed between Emacs version
> 21.2 and 26.2 that resulted in these backslashes being
> added. According to RFC822 and other email standards, these
> backslashes are not needed. Emacs should not be modifying the headers
> of emails needlessly.

I've been perusing the relevant RFCs, but I can't find anything about
having to quote commas and parentheses in quoted-strings.  It's not
disallowed, either -- the RFC says

3.2.1.  Quoted characters

   Some characters are reserved for special interpretation, such as
   delimiting lexical tokens.  To permit use of these characters as
   uninterpreted data, a quoting mechanism is provided.

   quoted-pair     =   ("\" (VCHAR / WSP)) / obs-qp

   Where any quoted-pair appears, it is to be interpreted as the
   character alone.  That is to say, the "\" character that appears as
   part of a quoted-pair is semantically "invisible".

so you can put a backslash in anywhere you want, basically, and it
should make no semantic difference.

But I'm not sure why this was added (in 2006).  Perhaps some MTAs/MUAs
react negatively to having those characters unquoted in strings?  It
looks like this was added by Katsumi, but the changelog doesn't say what
problem it's trying to fix.

Katsumi, do you remember?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.