patman: separate emails in CC list with NULs
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 22 Oct 2019 03:09:56 +0000 (20:09 -0700)
committerSimon Glass <sjg@chromium.org>
Sun, 27 Oct 2019 16:56:51 +0000 (10:56 -0600)
There is a contributor in Linux kernel with a comma in their name, which
confuses patman and results in invalid to- or cc- addresses on some
patches. To avoid this, let's use \0 as a separator when generating cc
file.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/patman/func_test.py
tools/patman/patman.py
tools/patman/series.py

index 50a2741439eafa819678845efbbb1adb5aa367c0..2321f9e028be7623469fc179035c873d27e21f34 100644 (file)
@@ -198,9 +198,9 @@ class TestFunctional(unittest.TestCase):
         line += 4
         self.assertEqual(expected, tools.ToUnicode(lines[line]))
 
-        self.assertEqual(('%s %s%s' % (args[0], rick, stefan)),
+        self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)),
                          tools.ToUnicode(cc_lines[0]))
-        self.assertEqual(('%s %s, %s, %s, %s' % (args[1], fred, ed, rick,
+        self.assertEqual(('%s %s\0%s\0%s\0%s' % (args[1], fred, ed, rick,
                                      stefan)), tools.ToUnicode(cc_lines[1]))
 
         expected = '''
index 9605a36eff2e398ac7a80297838fd6a13969c8e1..0187ebe1d4bf79d3f37b414adf3ac2389df9fb98 100755 (executable)
@@ -112,7 +112,7 @@ elif options.cc_cmd:
     for line in fd.readlines():
         match = re_line.match(line)
         if match and match.group(1) == args[0]:
-            for cc in match.group(2).split(''):
+            for cc in match.group(2).split('\0'):
                 cc = cc.strip()
                 if cc:
                     print(cc)
index 67103f03e6959d32ebef5ebb5fc497cba4743957..d667d9b6d61c257ad33759e25b619fd6ee259d85 100644 (file)
@@ -243,13 +243,13 @@ class Series(dict):
             if limit is not None:
                 cc = cc[:limit]
             all_ccs += cc
-            print(commit.patch, ''.join(sorted(set(cc))), file=fd)
+            print(commit.patch, '\0'.join(sorted(set(cc))), file=fd)
             self._generated_cc[commit.patch] = cc
 
         if cover_fname:
             cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
             cover_cc = [tools.FromUnicode(m) for m in cover_cc]
-            cc_list = ''.join([tools.ToUnicode(x)
+            cc_list = '\0'.join([tools.ToUnicode(x)
                                  for x in sorted(set(cover_cc + all_ccs))])
             print(cover_fname, cc_list.encode('utf-8'), file=fd)