Commit db413dd4 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

parsemail: Use the sum of payloads for the comments

Payload is the content of the last text part of the multipart message.

Mailing lists sometimes append their own footers as a new part. This
happens for emails that are already multipart or the ones with more
uncommon encodings.

In those cases we end up with an empty comment, as the footer is then
stripped out via clean_content().

We cannot use the commentbuf as it has anything diff-like stripped out
by parse_patch().

Fixes #39Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 80587a7a
Pipeline #105571 passed with stage
in 1 minute and 38 seconds
......@@ -363,6 +363,7 @@ def find_content(project, mail, force_comment=False):
commentbuf = ''
pullurl = None
is_attachment = False
sum_of_payloads = ''
for part in mail.walk():
if part.get_content_maintype() != 'text':
......@@ -404,6 +405,7 @@ def find_content(project, mail, force_comment=False):
patchbuf = payload
elif subtype == 'plain':
sum_of_payloads += payload + '\n'
c = payload
if not patchbuf:
......@@ -479,7 +481,7 @@ def find_content(project, mail, force_comment=False):
if not cpatch:
return ret
ret.comment = Comment(patch=cpatch, date=mail_date(mail),
content=clean_content(payload),
content=clean_content(sum_of_payloads),
headers=mail_headers(mail))
# make sure we always have a valid (series,revision) tuple if we have a
......
From wayland-devel-bounces@lists.freedesktop.org Tue May 21 10:07:21 2019
Delivered-To: daniel@fooishbar.org
Received: by 2002:ab3:5f92:0:0:0:0:0 with SMTP id w18csp1121831ltc;
Tue, 21 May 2019 02:07:21 -0700 (PDT)
X-Google-Smtp-Source: APXvYqwDMA6GvfN1C0sz6fhsqAGYo3uwSNOIe0onB4CdULeJs8AItbqKXG3GNYUJzLdHmFeVE7cl
X-Received: by 2002:a17:902:8609:: with SMTP id f9mr24414606plo.252.1558429641430;
Tue, 21 May 2019 02:07:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1558429641; cv=none;
d=google.com; s=arc-20160816;
b=pKZAHbZu72xYc/IkvVr213lrt7FR3Y8Iq89XQ+fqI9ZDl+R03I0oJyhdAGS+X3i9RT
Hf8USc3MLHFUBzxxXCseh4B9fm7CDYLE7jrp7FFwH00NNsHP532YvUP3WAJvvXK7spi4
kwVQM3T9QTEG9oS6sNmaWQ4xJa2nV9Vjf8dQ/1ow8MJyVa0m4fJqBwXHsfp1djrSkpfK
QEboPARY40uwIzS4eF0kbiHj8Q809e2xEp7ClFKd0MGI98GA7aCnMkaqsOt98KTutKLa
weGQP3iQaLv2kd/fSEf4DrJax1bgZrpZexXsHgOQpIF73sd9NDtYU7X0oUXg35p042Xk
/zkA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive
:list-unsubscribe:list-id:precedence:mime-version:references
:in-reply-to:message-id:subject:to:from:date:delivered-to;
bh=XbKVaClnTCucJI8qD0ONDYhsZjPgADfTRcQI6gmKllU=;
b=B3zGQUuYK/L8zD+s7MCAFfrK+ZVkwpycRvQTmnCgYhTX0ZMd90rV3PdOhlRJ29b5BO
c0MWmsF5ioZDK+4P4PO0gaQz0FnUAfrdfEP7TK/N0GIMBf58mgdXFIDkqUfI1DuYce4w
0nTOImgR0X7jH9KJ3vfjoG9Ev2iQ4kLEdWk3UC8HTYg+V9Tw1YEeyPfXReqOc7w8SWzg
UQV/NjWnIytKFIFrCZkWYCMz4Z+mNA68lzLoKVP6UnmNtu64A0V+L26tUJLoxRg2o14c
UfiiWKRiFPvGYuzhX8q3czXFTbWbmwMwSaAWq3viO/JxRQOWYmXeyRfXJJMxU1XBmU3c
zekQ==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: best guess record for domain of wayland-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=wayland-devel-bounces@lists.freedesktop.org;
dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Return-Path: <wayland-devel-bounces@lists.freedesktop.org>
Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177])
by mx.google.com with ESMTPS id c123si21219332pfg.35.2019.05.21.02.07.21
for <daniel@fooishbar.org>
(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
Tue, 21 May 2019 02:07:21 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of wayland-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177;
Authentication-Results: mx.google.com;
spf=pass (google.com: best guess record for domain of wayland-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=wayland-devel-bounces@lists.freedesktop.org;
dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Received: from gabe.freedesktop.org (localhost [127.0.0.1])
by gabe.freedesktop.org (Postfix) with ESMTP id 62BB7891A4;
Tue, 21 May 2019 09:07:20 +0000 (UTC)
X-Original-To: wayland-devel@lists.freedesktop.org
Delivered-To: wayland-devel@lists.freedesktop.org
Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com
[IPv6:2a00:1450:4864:20::243])
by gabe.freedesktop.org (Postfix) with ESMTPS id 90283891A4;
Tue, 21 May 2019 09:07:18 +0000 (UTC)
Received: by mail-lj1-x243.google.com with SMTP id e13so15095651ljl.11;
Tue, 21 May 2019 02:07:18 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
:references:mime-version;
bh=9612Tf+sK5snInFYphGIIxQ5vnfq8tFzesSfj8BgP7Y=;
b=MMtIOWiABT7YnHc7cbxjTK1sDQbcjga+sjznMjvl1gkMXbu0ctpZDlUSc6s9IhpW0t
UZBQZhM/yTqd6d0liUSsloQRsFiRGzheUE+u/QJ6rVWT7RRaQNdAdCf5qKVtpFgHZsHx
xehcdwhNz6t5Sa3q1CXtjfJqCLetFkgaljx+S+2ybSPBWEW9/lJgIarHZ0ess14Bz+d1
yc8QCKOoVM+GvTBtPK/lgm5ONinkycA8x6DHqPtETvozWWv32QrKTEaF+P6aJelK1ndc
4P/OuiwMwTfUpj+IbpIM6oMC6UGpsMOillT1OuDWSBpar2GwYcx8VWSo60V0NtcKu/6m
UepQ==
X-Gm-Message-State: APjAAAWdEvuwkoPa79EawHkOwr62WGgRSoDOnav8Umtk53vshoGivS1w
FojNU1mDhSaNJ59sRa7pmIk=
X-Received: by 2002:a2e:8954:: with SMTP id b20mr30429255ljk.10.1558429636890;
Tue, 21 May 2019 02:07:16 -0700 (PDT)
Received: from eldfell.localdomain ([194.136.85.206])
by smtp.gmail.com with ESMTPSA id x23sm4549626ljb.29.2019.05.21.02.07.16
(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
Tue, 21 May 2019 02:07:16 -0700 (PDT)
Date: Tue, 21 May 2019 12:07:12 +0300
From: Pekka Paalanen <ppaalanen@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/doc: More fine-tuning on userspace review requirements
Message-ID: <20190521120712.05b0a46a@eldfell.localdomain>
In-Reply-To: <20190521084849.27452-1-daniel.vetter@ffwll.ch>
References: <20190521084849.27452-1-daniel.vetter@ffwll.ch>
X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=date:from:to:cc:subject:message-id:in-reply-to:references
:mime-version;
bh=9612Tf+sK5snInFYphGIIxQ5vnfq8tFzesSfj8BgP7Y=;
b=Aa02Qo/FgF+cPEZSd9XPEcraydfC6kujkHskYSJ4F5/ewVBg2YNUpvME2EzPLPXkIY
pm6LUBM8gFH2n1GOsH46i60K7LtFFVnRlh12ME85GGzvR3jX0SDNHseGnJZ5RPklx2Pg
3VzfkD/lG7Stm/nE7wx7PNSCOehfjf04rLQm0qyjhoNesic+5Qz/ViiuxduJo8oiAoWr
T3StLqlGn3YYmGOlj29p/mVyXd5PoX0lYKPvW3SDrZhI4OR5N+qo99DyJvejGI8hnP/J
xkZbBL9wC4a/JMMZX/ykAXKFUnDM8/yOv77R6XPlAjlbFl+BPPhIqBGE0R3gv0bScA+n
okQQ==
X-BeenThere: wayland-devel@lists.freedesktop.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Discussion about the wayland display server
<wayland-devel.lists.freedesktop.org>
List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/wayland-devel>,
<mailto:wayland-devel-request@lists.freedesktop.org?subject=unsubscribe>
List-Archive: <https://lists.freedesktop.org/archives/wayland-devel>
List-Post: <mailto:wayland-devel@lists.freedesktop.org>
List-Help: <mailto:wayland-devel-request@lists.freedesktop.org?subject=help>
List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/wayland-devel>,
<mailto:wayland-devel-request@lists.freedesktop.org?subject=subscribe>
Cc: Daniel Vetter <daniel.vetter@intel.com>, Eric Anholt <eric@anholt.net>,
wayland-devel@lists.freedesktop.org,
DRI Development <dri-devel@lists.freedesktop.org>
Content-Type: multipart/mixed; boundary="===============1252825961=="
Errors-To: wayland-devel-bounces@lists.freedesktop.org
Sender: "wayland-devel" <wayland-devel-bounces@lists.freedesktop.org>
X-TUID: nzhYawZ7Bo3f
Status: RO
Content-Length: 3837
--===============1252825961==
Content-Type: multipart/signed; micalg=pgp-sha256;
boundary="Sig_/AqtM96bSPR/rWx0jmFwEdY5"; protocol="application/pgp-signature"
--Sig_/AqtM96bSPR/rWx0jmFwEdY5
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
On Tue, 21 May 2019 10:48:49 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> With Eric's patch
>=20
> commit ba6e798ecf320716780bb6a6088a8d17dcba1d49
> Author: Eric Anholt <eric@anholt.net>
> Date: Wed Apr 24 11:56:17 2019 -0700
>=20
> drm/doc: Document expectation that userspace review looks at kernel u=
API.
>=20
> there's been concerns raised that we expect userspace people to do
> in-depth kernel patch review. That's not reasonable, same way kernel
> people can't review all the userspace we have. Try to clarify
> expectations a bit more.
>=20
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: contact@emersion.fr
> Cc: wayland-devel@lists.freedesktop.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> Documentation/gpu/drm-uapi.rst | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>=20
> diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.=
rst
> index 05874d09820c..f368e58fb727 100644
> --- a/Documentation/gpu/drm-uapi.rst
> +++ b/Documentation/gpu/drm-uapi.rst
> @@ -85,9 +85,9 @@ leads to a few additional requirements:
> - The userspace side must be fully reviewed and tested to the standards =
of that
> userspace project. For e.g. mesa this means piglit testcases and revie=
w on the
> mailing list. This is again to ensure that the new interface actually =
gets the
> - job done. The userspace-side reviewer should also provide at least an
> - Acked-by on the kernel uAPI patch indicating that they've looked at ho=
w the
> - kernel side is implementing the new feature being used.
> + job done. The userspace-side reviewer should also provide an Acked-by=
on the
> + kernel uAPI patch indicating that they believe the proposed uAPI is so=
und and
> + sufficiently documented and validated for userspace's consumption.
> =20
> - The userspace patches must be against the canonical upstream, not some=
vendor
> fork. This is to make sure that no one cheats on the review and testing
Thank you for clarifying this. I can work with that.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Thanks,
pq
--Sig_/AqtM96bSPR/rWx0jmFwEdY5
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAlzjv8AACgkQI1/ltBGq
qqcPEg//RQDts7tTCP5ejz+X4GH+FrkDShd1nCYmRxCX2zj3/xRsiyM1fvDYVmF/
QC4dItoCc9/HLFg0ymhFyWwHOBdYj6jgrk/VDMwmJ1IMhWFO+09xbfR7Oml6wDD+
e18Lnm5Zdh++z/d+bG3GfhTYIbUYwu4AebvFGqVG1lGhkSeUBtjFAuvSEHDxHfkn
KI3mBepVNX051ENW1t5DSkc75xCUHxLpAnJuO3+vxKUYg/8A5Rg+xMDSO7AiXkCG
hVyS6M/c3zI6yuyOTftXPRNpGRzrRGwlNGc6UrlEbEsSkISWoBiP2TTNUYa+l4Gu
r9KScfqDwD+c+kdO6mEqOKX1avOq3zQqaAsxmc6632q7Ph6ER6V0hiJTZvng30bR
28iJlBvTfTsHMjmZIS5/DWR/GlOE0iUzFfKJWxnu9Kk9SiFM2mL/Ahu8Ot1+Zz/7
d2c66YuSbNI4JKgwC2WJxrr3ElK8E9Iuv5PVlPKz5oBGV3KSTdk61EeONafKot57
7P/osiCNFum2+VzvQk05lO7sEhAWDBr0Z57SXQAHqjS1GK6ntdXnIqr93c4S4MY+
mxcocNlJl1r9f3zufSpKBexhP7BSI93rxl60xZt48OZoMTOTdjn+F5f+F06jJgMv
U9RMmNgawV8sO2a5Nq6eBz2UpUiuO9ryyJxWGFRDxCoQ6kI0dR8=
=WMlX
-----END PGP SIGNATURE-----
--Sig_/AqtM96bSPR/rWx0jmFwEdY5--
--===============1252825961==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kd2F5bGFuZC1k
ZXZlbCBtYWlsaW5nIGxpc3QKd2F5bGFuZC1kZXZlbEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0
cHM6Ly9saXN0cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby93YXlsYW5kLWRldmVs
--===============1252825961==--
......@@ -298,6 +298,47 @@ class SenderCorrelationTest(TestCase):
self.person.delete()
class MultiPartEmailHandling(TestCase):
fixtures = ['default_states', 'default_events']
msgid = '<1@example.com>'
patch_filename = '0001-add-line.patch'
test_comment = 'Test Comment'
def setUp(self):
self.p1 = Project(linkname='test-project-1', name='Project 1',
listid='1.example.com', listemail='1@example.com')
self.p1.save()
patch = read_patch(self.patch_filename)
email = create_email(self.test_comment + '\n' + patch)
del email['Message-Id']
email['Message-Id'] = self.msgid
parse_mail(email)
del email['List-ID']
email['List-ID'] = '<' + self.p1.listid + '>'
parse_mail(email)
self.assertEqual(Patch.objects.filter(project=self.p1).count(), 1)
def testCommentMultipart(self):
comment_mail = read_mail('0013-multipart-comment.mbox',
project=self.p1)
del comment_mail['In-Reply-To']
comment_mail['In-Reply-To'] = self.msgid
parse_mail(comment_mail)
comments = Comment.objects.filter(msgid=comment_mail['Message-Id'])
self.assertEqual(comments.count(), 1)
comment = comments[0]
self.assertTrue("Reviewed-by:" in comment.content)
def tearDown(self):
self.p1.delete()
class MultipleProjectPatchTest(TestCase):
""" Test that patches sent to multiple patchwork projects are
handled correctly """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment