Skip to contentSkip to conversation

mbox: Fix splat in get_series()

PATCH New Rob Herring (Arm) 1 participant 1 message Jul 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbox: Fix splat in get_series()

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_ [email protected]
Looking up https://lore.kernel.org/[email protected]
Grabbing thread from lore.kernel.org/all/[email protected]/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")
---
 src/b4/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/b4/__init__.py +1 -1
index 139f94181234..daf17a9631ef 100644
@@ -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]
Signature · 1 line
2.47.2