All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Linus Torvalds <torvalds@linuxfoundation.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	users@kernel.org, tools@kernel.org
Subject: Re: [b4] initial "b4 dig" to supplant Link: trailers
Date: Sat, 11 Oct 2025 19:38:14 -0400	[thread overview]
Message-ID: <aOrqZsBZemu6MkAd@laps> (raw)
In-Reply-To: <CAHk-=wgNNVkgDco67tVceM87B7kkVZK=Oz8RZti1v6N2_+S+2w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

On Sat, Oct 11, 2025 at 03:46:39PM -0700, Linus Torvalds wrote:
>On Fri, 10 Oct 2025 at 13:48, Konstantin Ryabitsev
><konstantin@linuxfoundation.org> wrote:
>>
>> 1. We don't currently weed out AUTOSEL/stable backports, so older commits may
>>    end up in lots of false positives for now. I've not yet figured out how to
>>    avoid this without hardcoding it to be kernel-specific.
>
>Why don't you just weed things out by the commit date? You know that
>any backports will have a date after that, and that anything that was
>the source of the commit will have a date before.
>
>The author date will be fuzzier - because it might come from the
>email, but it might also come from the email *containing* a "Date:"
>line. But the commit date is reliable.
>
>And by "reliable", I obviously dismiss people having their clocks set
>wrong etc, but that seems to be happening a lot less often these days
>than it used to.

We have plenty of headers in stable-related mails that you can filter by to
avoid that noise. Something like the attached patch?

It also fixes the issue that Greg reported earlier in the thread:

$ b4.sh dig -c  cfa1a2329a691ffd991fcf7248a57d752e712881
[...]
This patch is present in the following series:
---
   v1: [PATCH bpf 1/2] bpf: Fix overrunning reservations in ringbuf
       https://lore.kernel.org/r/20240620213435.16336-1-daniel@iogearbox.net
   v2: [PATCH bpf v2 1/2] bpf: Fix overrunning reservations in ringbuf
       https://lore.kernel.org/r/20240621122610.15083-1-daniel@iogearbox.net
   v3: [PATCH bpf v3 1/2] bpf: Fix overrunning reservations in ringbuf
       https://lore.kernel.org/r/20240621140828.18238-1-daniel@iogearbox.net

-- 
Thanks,
Sasha

[-- Attachment #2: no_stable.patch --]
[-- Type: text/x-diff, Size: 3443 bytes --]

diff --git a/src/b4/dig.py b/src/b4/dig.py
index e5577a2..71e4fc7 100644
--- a/src/b4/dig.py
+++ b/src/b4/dig.py
@@ -25,6 +25,55 @@ try_diff_algos: List[str] = [
 ]
 
 
+def has_stable_header(msg: EmailMessage) -> bool:
+    """Check if the message has an X-stable header."""
+    for header_name in msg.keys():
+        if header_name.lower() == 'x-stable':
+            return True
+    return False
+
+
+def filter_stable_messages(lmbx: b4.LoreMailbox) -> None:
+    """Remove messages with X-stable header from a LoreMailbox."""
+    # Filter msgid_map
+    stable_msgids = []
+    for msgid, lmsg in lmbx.msgid_map.items():
+        if has_stable_header(lmsg.msg):
+            logger.debug('Ignoring -stable message: %s', lmsg.full_subject)
+            stable_msgids.append(msgid)
+
+    for msgid in stable_msgids:
+        del lmbx.msgid_map[msgid]
+
+    # Filter followups
+    lmbx.followups = [lmsg for lmsg in lmbx.followups
+                      if not has_stable_header(lmsg.msg)]
+
+    # Filter unknowns
+    lmbx.unknowns = [lmsg for lmsg in lmbx.unknowns
+                     if not has_stable_header(lmsg.msg)]
+
+    # Filter covers
+    stable_cover_revs = []
+    for rev, lmsg in lmbx.covers.items():
+        if has_stable_header(lmsg.msg):
+            stable_cover_revs.append(rev)
+
+    for rev in stable_cover_revs:
+        del lmbx.covers[rev]
+
+    # Filter series patches
+    for rev, lser in list(lmbx.series.items()):
+        original_count = len([p for p in lser.patches if p is not None])
+        lser.patches = [p if p is None or not has_stable_header(p.msg) else None
+                        for p in lser.patches]
+        filtered_count = len([p for p in lser.patches if p is not None])
+
+        # Remove series if all patches were filtered out
+        if filtered_count == 0:
+            del lmbx.series[rev]
+
+
 def dig_commit(cmdargs: argparse.Namespace) -> None:
     config = b4.get_main_config()
     cfg_llval = config.get('linkmask', '')
@@ -101,6 +150,12 @@ def dig_commit(cmdargs: argparse.Namespace) -> None:
         lmbx = b4.get_series_by_patch_id(patch_id)
         if lmbx:
             logger.info('Found matching series by patch-id')
+            filter_stable_messages(lmbx)
+            # Check if we still have any series after filtering
+            if not lmbx.series:
+                logger.debug('All series filtered out due to X-stable header')
+                lmbx = None
+                continue
             break
 
     if not lmbx:
@@ -111,6 +166,9 @@ def dig_commit(cmdargs: argparse.Namespace) -> None:
             logger.info('Found %s matching messages', len(msgs))
             lmbx = b4.LoreMailbox()
             for msg in msgs:
+                if has_stable_header(msg):
+                    logger.debug('Ignoring -stable message: %s', msg.get('subject', ''))
+                    continue
                 lmbx.add_message(msg)
         else:
             logger.error('Could not find anything matching commit %s', commit)
@@ -147,6 +205,9 @@ def dig_commit(cmdargs: argparse.Namespace) -> None:
         q_msgs = b4.get_pi_search_results(q, full_threads=True)
         if q_msgs:
             for q_msg in q_msgs:
+                if has_stable_header(q_msg):
+                    logger.debug('Ignoring -stable message: %s', q_msg.get('subject', ''))
+                    continue
                 lmbx.add_message(q_msg)
         break
 

  reply	other threads:[~2025-10-11 23:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10 20:47 [b4] initial "b4 dig" to supplant Link: trailers Konstantin Ryabitsev
2025-10-11 12:39 ` Greg KH
2025-10-13  8:13   ` Peter Zijlstra
2025-10-11 20:08 ` Geert Uytterhoeven
2025-10-11 22:46 ` Linus Torvalds
2025-10-11 23:38   ` Sasha Levin [this message]
2025-10-11 23:44     ` Linus Torvalds
2025-10-12  0:39       ` Sasha Levin
2025-10-12 23:17       ` Jason Gunthorpe
2025-10-13 17:12 ` Mark Brown
2025-10-13 17:36   ` Linus Torvalds
2025-10-14 21:17 ` Konstantin Ryabitsev
2025-10-14 21:49   ` Sasha Levin
2025-10-15 13:47     ` Konstantin Ryabitsev
2025-10-14 22:13   ` Mark Brown
2025-10-15 13:44     ` Konstantin Ryabitsev
2025-10-15 13:52       ` Mark Brown
2025-10-15 16:40       ` Rob Herring
2025-10-15  2:52   ` Martin K. Petersen
2025-10-15 13:43     ` Konstantin Ryabitsev
2025-10-15 17:37       ` Martin K. Petersen

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=aOrqZsBZemu6MkAd@laps \
    --to=sashal@kernel.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    --cc=torvalds@linuxfoundation.org \
    --cc=users@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.