tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rob Herring (Arm)" <robh@kernel.org>
To: tools@kernel.org
Subject: [PATCH] mbox: Fix splat in get_series()
Date: Mon, 14 Jul 2025 16:17:26 -0500	[thread overview]
Message-ID: <20250714211726.3151132-1-robh@kernel.org> (raw)

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


                 reply	other threads:[~2025-07-14 21:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250714211726.3151132-1-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).