tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mbox: Fix splat in get_series()
@ 2025-07-14 21:17 Rob Herring (Arm)
  0 siblings, 0 replies; only message in thread
From: Rob Herring (Arm) @ 2025-07-14 21:17 UTC (permalink / raw)
  To: tools

Since commit 0c7bd8a7ec09 ("mbox: fix backtrace when we can't find the
in-reply-to message"), attempting to apply a retrieve a specific patch
and check for newer revisions results in a splat:

$ b4 am -c -P_ 20250711035730.17507-2-iuncuim@gmail.com
Looking up https://lore.kernel.org/20250711035730.17507-2-iuncuim@gmail.com
Grabbing thread from lore.kernel.org/all/20250711035730.17507-2-iuncuim@gmail.com/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 4 messages in the thread
Analyzing 3 code-review messages
Traceback (most recent call last):
  File "/home/rob/.local/bin/b4", line 8, in <module>
    sys.exit(cmd())
             ~~~^^
  File "/home/rob/proj/b4/src/b4/command.py", line 435, in cmd
    cmdargs.func(cmdargs)
    ~~~~~~~~~~~~^^^^^^^^^
  File "/home/rob/proj/b4/src/b4/command.py", line 105, in cmd_shazam
    b4.mbox.main(cmdargs)
    ~~~~~~~~~~~~^^^^^^^^^
  File "/home/rob/proj/b4/src/b4/mbox.py", line 843, in main
    make_am(msgs, cmdargs, msgid)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/proj/b4/src/b4/mbox.py", line 113, in make_am
    lser = lmbx.get_series(revision=wantver, sloppytrailers=cmdargs.sloppytrailers, reroll=reroll,
                           codereview_trailers=load_codereview)
  File "/home/rob/proj/b4/src/b4/__init__.py", line 362, in get_series
    if pmsg is None:
       ^^^^
UnboundLocalError: cannot access local variable 'pmsg' where it is not associated with a value

Fixes: 0c7bd8a7ec09 ("mbox: fix backtrace when we can't find the in-reply-to message")
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 src/b4/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 139f94181234..daf17a9631ef 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -348,9 +348,9 @@ class LoreMailbox:
             # we either run out of in-reply-tos, or we find a patch in
             # one of our series
             logger.debug('fmsg.in_reply_to=%s', fmsg.in_reply_to)
+            pmsg = None
             if fmsg.in_reply_to is None:
                 # Check if there's something matching in References
-                pmsg = None
                 for refid in fmsg.references:
                     if refid in self.msgid_map and refid != fmsg.msgid:
                         pmsg = self.msgid_map[refid]
-- 
2.47.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-14 21:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 21:17 [PATCH] mbox: Fix splat in get_series() Rob Herring (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).