From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?J=C3=A9r=C3=A9my?= Compostella Newsgroups: gmane.emacs.bugs Subject: bug#39230: [PATCH] Expand text/html regardless of it position in the MIME tree Date: Fri, 28 Feb 2020 10:13:41 -0700 Message-ID: References: <878sm05s8b.fsf@jcompost-mobl.ch.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000037f78a059fa5f692" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="117783"; mail-complaints-to="usenet@ciao.gmane.io" To: 39230@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 28 18:34:08 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7jWZ-000UWE-MW for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Feb 2020 18:34:07 +0100 Original-Received: from localhost ([::1]:51488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7jWY-00083M-Ls for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Feb 2020 12:34:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34573) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7jD9-0008TR-VE for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:14:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7jD8-00050M-Cp for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56000) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7jD8-0004zz-8n for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j7jD8-00032W-1w for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?J=C3=A9r=C3=A9my?= Compostella Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Feb 2020 17:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39230 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158291003911666 (code B ref -1); Fri, 28 Feb 2020 17:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Feb 2020 17:13:59 +0000 Original-Received: from localhost ([127.0.0.1]:33740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7jD5-000325-GJ for submit@debbugs.gnu.org; Fri, 28 Feb 2020 12:13:59 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:50096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7jD3-00031w-NX for submit@debbugs.gnu.org; Fri, 28 Feb 2020 12:13:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34531) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7jD1-00089o-Us for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:13:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7jD0-0004pz-HD for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:13:55 -0500 Original-Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]:40170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7jD0-0004oc-8G for bug-gnu-emacs@gnu.org; Fri, 28 Feb 2020 12:13:54 -0500 Original-Received: by mail-io1-xd43.google.com with SMTP id x1so4183960iop.7 for ; Fri, 28 Feb 2020 09:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=FrXbDzggDzRS7R0YOePzxavPAtXUJ9xtn5TqNdwCMw8=; b=GypmMA0h0syC0RB37LgWVLaX5S0aUpk6k568G8+z+tSX6NPJsPMEUoMQ6ymXlKZ61i 1mHJB4aX3olMnH4PTgHoex+jxjrh8LT813Rm08RxoWzE/bzCzhsB+K1BoBtVH5zlUerB mc8f/qLqPqlHtY8s0aMcXevgj+rJ6RRLFkFjylOon1pTF6qDEJNeXpgI2LdJTjohdh5G bMNPsIs4WXHN5wM+v0eGoaDesBi88Xcwc+ob1mvj+yFp3lggi8dtCqFIHiggc3GJf9YL vsFv2m1DPsp16zlzv+yncq/C9tM+vRhv0/hCXTq9P09gs7xCc4O7A/uMZTx2PBBjib2C Antg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=FrXbDzggDzRS7R0YOePzxavPAtXUJ9xtn5TqNdwCMw8=; b=q9S4pnElccMJPd95rS3f3zJsbKEb3ZFCAmZm8dNmjdr7f5WrPH5DDUHzTevjIRyhvE dE842hmn9dKDCk87xBZdAJuKZD3XyVFgyL8q70/fqiHPqXGRMvuukJtac5kZr1RzHQrq AUINFIqzaQZK/LYB/IYF39QsA1nTIcdT2bN+XNQUrdChk/GBYmxBUuSFg9Z+QasvGTxD fM124Ql2OWR6oIJE4fg5Nt0G9nqyPjx/n590A+RUs48B2x6weYG8h8Ya0r2Bak9fgJxy FoBvR3Ms7v7TBi2DOMWJT4SMFOzuNvAcci3qqHGQ9LIesRgnAGU7+ArQTuzlL3DAPzgz 1LwQ== X-Gm-Message-State: APjAAAUfWsoevtFHdXEhj+Djunr1yiEeHF69XOaRIWausTDskFo2NflK Xx5G3DlL8F4OUfGRQyiqdpVhWNAusCv0GyEOUyziCuFAQ1o= X-Google-Smtp-Source: APXvYqzhB7JSmjnxCEow4UIL3Il/durTbwRonXBaHcNP8r4kiGcN0KdPj55qgQdMdWkBm1U586ohB3UE65i/4+VGs5s= X-Received: by 2002:a05:6638:501:: with SMTP id i1mr4117432jar.25.1582910032818; Fri, 28 Feb 2020 09:13:52 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176596 Archived-At: --00000000000037f78a059fa5f692 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable An issue has been identified with this patch for which I wrote a fix. I ran many tests and combination with this additional patch (see attachement) and I could not find any issue left. The reason I missed this obvious bug was my configuration using my `org-msg' module which has an advice on `mml-expand-html-into-multipart-related' to workaround the limitation that my previous patch addresses. The issue originates from the fact that the `mml-expand-html-into-multipart-related' function returns a list of list for an untouched part while it returns a simple list for expanded multipart. The recursive engine of `mml-expand-all-html-into-multipart-related' is not handling this. Considering that the `mml-expand-html-into-multipart-related' function is only used by mml as an internal function, IMO the best approach is to make it consistent on its potential return values structure. The patch I am submitting here makes `mml-expand-html-into-multipart-related' returns a simple list regardless of if it is a part or a multipart. On Wed, Feb 12, 2020 at 11:18 AM J=C3=A9r=C3=A9my Compostella wrote: > > Hi, > > I would really appreciate if I could receive a feedback on this patch. I= can't send GPG HTML email because of this limitation and this is is also b= locking an issue reported of my org-msg module. > > I have attached the patch here as I have fixed a typo in the commit headl= ine. > > Let me know if I need to address this patch to another mailing list. > > Regards, > Jeremy > . > > On Tue, Jan 21, 2020 at 4:01 PM Jeremy Compostella wrote: >> >> If the text/html part is not the unique part of the email, >> mml-generate-mime does not expand it to a related multipart. This >> break uses cases like PGP signing of an HTML email including images. >> >> For instance, if you compose an email with the >> and a , the second part is >> not expanded into a multipart related and the images are not included. >> >> Signed-off-by: Jeremy Compostella >> --- >> lisp/gnus/mml.el | 19 ++++++++++++++----- >> 1 file changed, 14 insertions(+), 5 deletions(-) >> >> diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el >> index cdd8f3d3a5..3d86c5bc40 100644 >> --- a/lisp/gnus/mml.el >> +++ b/lisp/gnus/mml.el >> @@ -487,11 +487,8 @@ type detected." >> (=3D (length cont) 1) >> content-type) >> (setcdr (assq 'type (cdr (car cont))) content-type)) >> - (when (and (consp (car cont)) >> - (=3D (length cont) 1) >> - (fboundp 'libxml-parse-html-region) >> - (equal (cdr (assq 'type (car cont))) "text/html")) >> - (setq cont (mml-expand-html-into-multipart-related (car cont)))) >> + (when (fboundp 'libxml-parse-html-region) >> + (setq cont (mapcar 'mml-expand-all-html-into-multipart-related c= ont))) >> (prog1 >> (with-temp-buffer >> (set-buffer-multibyte nil) >> @@ -510,6 +507,18 @@ type detected." >> (buffer-string)) >> (setq message-options options))))) >> >> +(defun mml-expand-all-html-into-multipart-related (cont) >> + (cond ((and (eq (car cont) 'part) >> + (equal (cdr (assq 'type cont)) "text/html")) >> + (mml-expand-html-into-multipart-related cont)) >> + ((eq (car cont) 'multipart) >> + (let ((cur (cdr cont))) >> + (while (consp cur) >> + (setcar cur (mml-expand-all-html-into-multipart-related (ca= r cur))) >> + (setf cur (cdr cur)))) >> + cont) >> + (t cont))) >> + >> (defun mml-expand-html-into-multipart-related (cont) >> (let ((new-parts nil) >> (cid 1)) >> -- >> 2.24.1 >> > > > -- > =C2=AB Si debugger, c'est supprimer des bugs, alors programmer ne peut = =C3=AAtre que les ajouter =C2=BB - Edsger Dijkstra --=20 =C2=AB Si debugger, c'est supprimer des bugs, alors programmer ne peut =C3= =AAtre que les ajouter =C2=BB - Edsger Dijkstra --00000000000037f78a059fa5f692 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-nesting-list.patch" Content-Disposition: attachment; filename="0001-Fix-nesting-list.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k76fr7i60 RnJvbSAwYmNkZDI3MDcxNTk3NmUxZGJlM2IwOTZmMzg4ZjdmM2Q2Njg5ODMxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKZXJlbXkgQ29tcG9zdGVsbGEgPGplcmVteS5jb21wb3N0ZWxs YUBnbWFpbC5jb20+CkRhdGU6IFNhdCwgMjIgRmViIDIwMjAgMTA6NTg6MjUgLTA3MDAKU3ViamVj dDogW1BBVENIXSBGaXggbmVzdGluZyBsaXN0CgoqIGxpc3AvZ251cy9tbWwuZWwgKG1tbC1leHBh bmQtaHRtbC1pbnRvLW11bHRpcGFydC1yZWxhdGVkKTogVGhpcyBpcwpmdW5jdGlvbiBpcyBub3cg Y2FsbGVkIGJ5IGEgcmVjdXJzaXZlCmVuZ2luZSAobW1sLWV4cGFuZC1hbGwtaHRtbC1pbnRvLW11 bHRpcGFydC1yZWxhdGVkKS4gIFRoZSBzdHJ1Y3R1cmUgb2YKdGhlIHJldHVybmVkIHZhbHVlIHNo b3VsZCBiZSBpZGVudGljYWwgYmV0d2VlbiBhbiB1bnRvdWNoZWQgcGFydCBhbmQgYQpleHBhbmRl Z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