diff mbox series

patman: Detect unexpected END

Message ID 20200702170824.16293-1-patrick.delaunay@st.com
State Accepted
Commit df1fa4b2239aaf2e4a7b72ff1e81cfa53af8b08e
Headers show
Series patman: Detect unexpected END | expand

Commit Message

Patrick Delaunay July 2, 2020, 5:08 p.m. UTC
Detect unexpected 'END' line when a section is not detected.

This patch detect issue when tag name for section start is misspelled,
for example 'Commit-note:' for 'Commit-notes:'

  Commit-note:
  ....
  END

Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:"
but 'END' is kept in commit message.

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

 tools/patman/patchstream.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass July 3, 2020, 3:50 a.m. UTC | #1
On Thu, 2 Jul 2020 at 11:08, Patrick Delaunay <patrick.delaunay at st.com> wrote:
>
> Detect unexpected 'END' line when a section is not detected.
>
> This patch detect issue when tag name for section start is misspelled,
> for example 'Commit-note:' for 'Commit-notes:'
>
>   Commit-note:
>   ....
>   END
>
> Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:"
> but 'END' is kept in commit message.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
>  tools/patman/patchstream.py | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 4fe465e9ab..a575c09b47 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -260,6 +260,10 @@  class PatchStream:
             else:
                 self.section.append(line)
 
+        # If we are not in a section, it is an unexpected END
+        elif line == 'END':
+                raise ValueError("'END' wihout section")
+
         # Detect the commit subject
         elif not is_blank and self.state == STATE_PATCH_SUBJECT:
             self.commit.subject = line