[PATCH 3/7] tags: be a bit more permissive in what we render to a message

Daniel Axtens dja at axtens.net
Thu Jan 25 13:43:13 AEDT 2018


Currently we render a tag from a comment into a message if it is

 '^(whatever)-by: .*'

We found a patch that had a UTF-8 non-breaking space after the colon,
and this was breaking the regex. So just remove the requirement for
a space entirely. Add the test from the original bug.

Closes: #124
Signed-off-by: Daniel Axtens <dja at axtens.net>

---

Stephen - if you get to merging this before I do, please check the
mbox file contains a unicode nbsp and hasn't been munged by git -
it should be 'Acked-by:<utf-8 nbsp><space>Christophe L...'
---
 patchwork/models.py                   |   2 +-
 patchwork/tests/series/weird-ack.mbox | 203 ++++++++++++++++++++++++++++++++++
 patchwork/tests/test_mboxviews.py     |  28 +++++
 3 files changed, 232 insertions(+), 1 deletion(-)
 create mode 100644 patchwork/tests/series/weird-ack.mbox

diff --git a/patchwork/models.py b/patchwork/models.py
index 11886f1a73a5..3bf7c72dbe08 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -317,7 +317,7 @@ class EmailMixin(models.Model):
     content = models.TextField(null=True, blank=True)
 
     response_re = re.compile(
-        r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by: .*$',
+        r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by:.*$',
         re.M | re.I)
 
     @property
diff --git a/patchwork/tests/series/weird-ack.mbox b/patchwork/tests/series/weird-ack.mbox
new file mode 100644
index 000000000000..932abcdd42af
--- /dev/null
+++ b/patchwork/tests/series/weird-ack.mbox
@@ -0,0 +1,203 @@
+From vaibhav at linux.vnet.ibm.com  Wed Oct  4 17:13:23 2017
+From: vaibhav at linux.vnet.ibm.com (Vaibhav Jain)
+Date: Wed,  4 Oct 2017 11:43:23 +0530
+Subject: [Skiboot] [PATCH v2] capp: Add lid definitions for P9 DD-2.0 &
+ DD-2.1
+Message-ID: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+
+Update fsp_lid_map to include CAPP ucode lids for phb4-chipid ==
+0x200d1 and phb4-chipid == 0x201d1 that corresponds to P9 DD-2.0 &
+DD-2.1 chips respectively.
+
+Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
+---
+Changelog:
+
+[v2] -> Updated the lid map to use same lid for DD-2.0 & DD-2.1
+chips
+
+---
+
+ hw/fsp/fsp.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
+index 4d173978..724c7f73 100644
+--- a/hw/fsp/fsp.c
++++ b/hw/fsp/fsp.c
+@@ -2357,6 +2357,8 @@ int fsp_fetch_data_queue(uint8_t flags, uint16_t id, uint32_t sub_id,
+ #define CAPP_IDX_MURANO_DD21 0x201ef
+ #define CAPP_IDX_NAPLES_DD10 0x100d3
+ #define CAPP_IDX_NIMBUS_DD10 0x100d1
++#define CAPP_IDX_NIMBUS_DD20 0x200d1
++#define CAPP_IDX_NIMBUS_DD21 0x201d1
+ 
+ static struct {
+ 	enum resource_id	id;
+@@ -2371,6 +2373,8 @@ static struct {
+ 	{ RESOURCE_ID_CAPP,	CAPP_IDX_VENICE_DD20,	0x80a02004 },
+ 	{ RESOURCE_ID_CAPP,	CAPP_IDX_NAPLES_DD10,	0x80a02005 },
+ 	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD10,	0x80a02006 },
++	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD20,	0x80a02007 },
++	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD21,	0x80a02007 },
+ };
+ 
+ static void fsp_start_fetching_next_lid(void);
+-- 
+2.13.6
+
+
+From clombard at linux.vnet.ibm.com  Wed Oct  4 18:46:09 2017
+From: clombard at linux.vnet.ibm.com (christophe lombard)
+Date: Wed, 4 Oct 2017 09:46:09 +0200
+Subject: [Skiboot] [PATCH v2] capp: Add lid definitions for P9 DD-2.0 &
+ DD-2.1
+In-Reply-To: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+References: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+Message-ID: <18733821-fba6-9bff-47e3-c0bbf7129d1d at linux.vnet.ibm.com>
+
+Le 04/10/2017 à 08:13, Vaibhav Jain a écrit :
+> Update fsp_lid_map to include CAPP ucode lids for phb4-chipid ==
+> 0x200d1 and phb4-chipid == 0x201d1 that corresponds to P9 DD-2.0 &
+> DD-2.1 chips respectively.
+>
+> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
+> ---
+> Changelog:
+>
+> [v2] -> Updated the lid map to use same lid for DD-2.0 & DD-2.1
+> chips
+>
+> ---
+
+Acked-by:  Christophe Lombard<clombard at linux.vnet.ibm.com>
+
+Thanks
+
+
+From fbarrat at linux.vnet.ibm.com  Wed Oct  4 23:41:05 2017
+From: fbarrat at linux.vnet.ibm.com (Frederic Barrat)
+Date: Wed, 4 Oct 2017 14:41:05 +0200
+Subject: [Skiboot] [PATCH v2] capp: Add lid definitions for P9 DD-2.0 &
+ DD-2.1
+In-Reply-To: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+References: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+Message-ID: <34991810-9c39-a8ad-31db-73894725be88 at linux.vnet.ibm.com>
+
+
+
+Le 04/10/2017 à 08:13, Vaibhav Jain a écrit :
+> Update fsp_lid_map to include CAPP ucode lids for phb4-chipid ==
+> 0x200d1 and phb4-chipid == 0x201d1 that corresponds to P9 DD-2.0 &
+> DD-2.1 chips respectively.
+> 
+> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
+> ---
+
+Looks ok to me.
+Reviewed-by: Frederic Barrat <fbarrat at linux.vnet.ibm.com>
+
+
+
+> Changelog:
+> 
+> [v2] -> Updated the lid map to use same lid for DD-2.0 & DD-2.1
+> chips
+> 
+> ---
+> 
+>   hw/fsp/fsp.c | 4 ++++
+>   1 file changed, 4 insertions(+)
+> 
+> diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
+> index 4d173978..724c7f73 100644
+> --- a/hw/fsp/fsp.c
+> +++ b/hw/fsp/fsp.c
+> @@ -2357,6 +2357,8 @@ int fsp_fetch_data_queue(uint8_t flags, uint16_t id, uint32_t sub_id,
+>   #define CAPP_IDX_MURANO_DD21 0x201ef
+>   #define CAPP_IDX_NAPLES_DD10 0x100d3
+>   #define CAPP_IDX_NIMBUS_DD10 0x100d1
+> +#define CAPP_IDX_NIMBUS_DD20 0x200d1
+> +#define CAPP_IDX_NIMBUS_DD21 0x201d1
+> 
+>   static struct {
+>   	enum resource_id	id;
+> @@ -2371,6 +2373,8 @@ static struct {
+>   	{ RESOURCE_ID_CAPP,	CAPP_IDX_VENICE_DD20,	0x80a02004 },
+>   	{ RESOURCE_ID_CAPP,	CAPP_IDX_NAPLES_DD10,	0x80a02005 },
+>   	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD10,	0x80a02006 },
+> +	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD20,	0x80a02007 },
+> +	{ RESOURCE_ID_CAPP,	CAPP_IDX_NIMBUS_DD21,	0x80a02007 },
+>   };
+> 
+>   static void fsp_start_fetching_next_lid(void);
+> 
+
+
+From stewart at linux.vnet.ibm.com  Fri Oct  6 17:23:02 2017
+From: stewart at linux.vnet.ibm.com (Stewart Smith)
+Date: Fri, 06 Oct 2017 17:23:02 +1100
+Subject: [Skiboot] [PATCH v2] capp: Add lid definitions for P9 DD-2.0 &
+ DD-2.1
+In-Reply-To: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+References: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+Message-ID: <87lgkog5h5.fsf at linux.vnet.ibm.com>
+
+Vaibhav Jain <vaibhav at linux.vnet.ibm.com> writes:
+> Update fsp_lid_map to include CAPP ucode lids for phb4-chipid ==
+> 0x200d1 and phb4-chipid == 0x201d1 that corresponds to P9 DD-2.0 &
+> DD-2.1 chips respectively.
+>
+> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
+> ---
+> Changelog:
+>
+> [v2] -> Updated the lid map to use same lid for DD-2.0 & DD-2.1
+> chips
+>
+> ---
+>
+>  hw/fsp/fsp.c | 4 ++++
+>  1 file changed, 4 insertions(+)
+
+Thanks. Merged as of 25e041a577616f80b7bf0553a50043e422f0296c
+
+-- 
+Stewart Smith
+OPAL Architect, IBM.
+
+
+From stewart at linux.vnet.ibm.com  Fri Oct  6 17:23:30 2017
+From: stewart at linux.vnet.ibm.com (Stewart Smith)
+Date: Fri, 06 Oct 2017 17:23:30 +1100
+Subject: [Skiboot] [PATCH v2] capp: Add lid definitions for P9 DD-2.0 &
+ DD-2.1
+In-Reply-To: <18733821-fba6-9bff-47e3-c0bbf7129d1d at linux.vnet.ibm.com>
+References: <20171004061323.18741-1-vaibhav at linux.vnet.ibm.com>
+ <18733821-fba6-9bff-47e3-c0bbf7129d1d at linux.vnet.ibm.com>
+Message-ID: <87infsg5gd.fsf at linux.vnet.ibm.com>
+
+christophe lombard <clombard at linux.vnet.ibm.com> writes:
+> Le 04/10/2017 à 08:13, Vaibhav Jain a écrit :
+>> Update fsp_lid_map to include CAPP ucode lids for phb4-chipid ==
+>> 0x200d1 and phb4-chipid == 0x201d1 that corresponds to P9 DD-2.0 &
+>> DD-2.1 chips respectively.
+>>
+>> Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
+>> ---
+>> Changelog:
+>>
+>> [v2] -> Updated the lid map to use same lid for DD-2.0 & DD-2.1
+>> chips
+>>
+>> ---
+>
+> Acked-by:  Christophe Lombard<clombard at linux.vnet.ibm.com>
+
+Hrm.. you seem to have some weird formatting here that broke patchwork
+picking up the acked-by. 
+-- 
+Stewart Smith
+OPAL Architect, IBM.
+
+
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index 0dc4abbeb715..472f2f62e13a 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -23,14 +23,19 @@ import datetime
 import dateutil.parser
 import dateutil.tz
 import email
+import mailbox
+import os
 
 from django.test import TestCase
 
+from patchwork import models
+from patchwork import parser
 from patchwork.compat import reverse
 from patchwork.tests.utils import create_comment
 from patchwork.tests.utils import create_patch
 from patchwork.tests.utils import create_project
 from patchwork.tests.utils import create_person
+from patchwork.tests.utils import create_state
 from patchwork.tests.utils import create_user
 
 
@@ -194,3 +199,26 @@ class MboxCommentPostcriptUnchangedTest(TestCase):
 
         self.assertContains(response, content)
         self.assertNotContains(response, content + '\n')
+
+
+class MboxUTF8nbspTest(TestCase):
+
+    def setUp(self):
+        create_state()
+        project = create_project()
+
+        mbox = mailbox.mbox(os.path.join(os.path.dirname(__file__),
+                                         'series', 'weird-ack.mbox'))
+        for msg in mbox:
+            obj = parser.parse_mail(msg, project.listid)
+            if type(obj) == models.Patch:
+                self.patch = obj
+        mbox.close()
+
+    def test_utf8_nbsp_ack(self):
+        """Validate that an
+            Acked-by:<utf-8 nbsp><space><name>
+        is preserved properly.
+        """
+        response = self.client.get(reverse('patch-mbox', args=[self.patch.id]))
+        self.assertContains(response, "Christophe Lombard")
-- 
2.14.1



More information about the Patchwork mailing list