[dpdk-ci] [PATCH v2 4/4] guess_git_tree: fix crash caused by empty diff

ohilyard at iol.unh.edu ohilyard at iol.unh.edu
Wed Oct 13 16:00:10 CEST 2021


From: Owen Hilyard <ohilyard at iol.unh.edu>

A sanity check has been added to find_filenames. Occasionally, due to
how the community lab internally handles getting patches from
patchworks, a patch will result in no diff. This patch adds handling for
this case.

Signed-off-by: Owen Hilyard <ohilyard at iol.unh.edu>
---
 tools/guess_git_tree.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/guess_git_tree.py b/tools/guess_git_tree.py
index e186f5e..63892e1 100755
--- a/tools/guess_git_tree.py
+++ b/tools/guess_git_tree.py
@@ -92,6 +92,11 @@ def find_filenames(diff):
             - Moved _filename_re into the method.
             - Reduced newlines.
         """
+        # sanity check diff
+        # for patches without any diff, it will try to run diff.replace
+        # while diff is None. just return an empty list
+        if diff is None:
+            return []
         _filename_re = re.compile(r'^(---|\+\+\+) (\S+)')
         # normalise spaces
         diff = diff.replace('\r', '')
-- 
2.30.2



More information about the ci mailing list