* [PATCH] b4: Fix offline mbox --check case
@ 2025-10-31 9:08 David Nyström
2026-02-24 19:53 ` Konstantin Ryabitsev
0 siblings, 1 reply; 2+ messages in thread
From: David Nyström @ 2025-10-31 9:08 UTC (permalink / raw)
To: tools; +Cc: David Nyström
Without this patch:
--
b4 -d shazam --check -s 20251028140009.2164260-1-archana.polampalli@windriver.com
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-eenY4T.eml (6150 bytes)
b4 -d --offline-mode shazam --check -s -m openembedded-core.mbox \
20251028140009.2164260-1-archana.polampalli@windriver.com
Unable to get payload from message <20251028140009.2164260-1-archana.polampalli@windriver.com>
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-YcwtJ7.eml (0 bytes)
With this patch:
--
b4 -d shazam --check -s 20251028140009.2164260-1-archana.polampalli@windriver.com
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-eenY4T.eml (6150 bytes)
b4 -d --offline-mode shazam --check -s -m openembedded-core.mbox \
20251028140009.2164260-1-archana.polampalli@windriver.com
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-QzxXnn.eml (11806 bytes)
Signed-off-by: David Nyström <david.nystrom@est.tech>
---
src/b4/__init__.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 33fbc3f..29682ed 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -1992,8 +1992,9 @@ class LoreMessage:
bdata += nl.encode()
payload = msg.get_payload(decode=True)
if not isinstance(payload, bytes):
- logger.critical('Unable to get payload from message %s', msg.get('Message-Id'))
- return b''
+ # Ensure per-patch checkers always receive usable input even if from a local mbox
+ body_text, _charset = LoreMessage.get_payload(msg, use_patch=True)
+ payload = body_text.encode('utf-8', errors='replace')
for bline in payload.split(b'\n'):
bdata += re.sub(rb'[\r\n]*$', b'', bline) + nl.encode()
return bdata
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-24 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 9:08 [PATCH] b4: Fix offline mbox --check case David Nyström
2026-02-24 19:53 ` Konstantin Ryabitsev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox