Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: tools@linux.kernel.org
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Robert Richter <rrichter@amd.com>,
	linux-cxl@vger.kernel.org,
	 Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>
Subject: [PATCH b4] am: Build patch series when additional patches appear in a thread
Date: Thu, 07 Dec 2023 21:42:37 -0800	[thread overview]
Message-ID: <20231207-series-from-non-reply-reply-v1-1-cb02de53857c@intel.com> (raw)

Dan reported that am/shazam cherry-pick was failing with a particular
CXL series.[1]

	$ b4 shazam -S -P _ 20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com
	Grabbing thread from lore.kernel.org/all/20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com/t.mbox.gz
	Checking for newer revisions
	Grabbing search results from lore.kernel.org
	Analyzing 8 messages in the thread
	Specified msgid is not present in the series, cannot cherrypick

The reason is series processing failed to detect that a non reply follow
on message containing a patch was not a replacement for the original.
The way this patch was submitted (without a 'Re:' subject prefix) is
actually a good thing.  This is because a reply would have implied a v2
to the original patch rather than a follow on patch as intended.

Teach b4 to interpret a thread like this by adding the additional patch
to the series with a warning.  The series can then be applied as normal
or with a cherry-pick as was necessary in this case.

A run after the fix looks like this:

	$ b4 shazam -S -P _ 20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com
	Grabbing thread from lore.kernel.org/all/20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com/t.mbox.gz
	Checking for newer revisions
	Grabbing search results from lore.kernel.org
	Analyzing 8 messages in the thread
	WARNING: duplicate messages found at index 1
	   Subject 1: cxl/cdat: Free correct buffer on checksum error
	   Subject 2: cxl/pci: Get rid of pointer arithmetic reading CDAT table
	  2 is not a reply... assume additional patch
	Checking attestation on all messages, may take a moment...
	---
	  ✓ [PATCH] cxl/cdat: Free correct buffer on checksum error
	    ✗ No key: ed25519/ira.weiny@intel.com
	    ✓ Signed: DKIM/intel.com
	    + Reviewed-by: Robert Richter <rrichter@amd.com> (✓ DKIM/amd.com)
	    + Reviewed-by: Fan Ni <fan.ni@samsung.com> (✗ DKIM/gmail.com)
	    + Reviewed-by: Dave Jiang <dave.jiang@intel.com> (✓ DKIM/intel.com)
	---
	Total patches: 1 (cherrypicked: <20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com>)
	---
	 Base: using specified base-commit 7475e51b87969e01a6812eac713a1c8310372e8a
	Applying: cxl/cdat: Free correct buffer on checksum error

[1] https://lore.kernel.org/all/20231116-fix-cdat-devm-free-v1-1-b148b40707d7@intel.com/

Reported-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 b4/__init__.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index 7d665f9e2c0a..f87daf838b4f 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -481,10 +481,20 @@ class LoreSeries:
         if self.patches[lmsg.counter] is not None:
             # Okay, weird, is the one in there a reply?
             omsg = self.patches[lmsg.counter]
+
+            logger.warn('WARNING: duplicate messages found at index %s', lmsg.counter)
+            logger.warn('   Subject 1: %s', lmsg.subject)
+            logger.warn('   Subject 2: %s', omsg.subject)
             if omsg.reply or (omsg.counters_inferred and not lmsg.counters_inferred):
                 # Replace that one with this one
-                logger.debug('  replacing existing: %s', omsg.subject)
+                logger.warn('  2 is a reply... replacing existing: %s', omsg.subject)
+                self.patches[lmsg.counter] = lmsg
+            else:
+                logger.warn('  2 is not a reply... assume additional patch')
+                self.patches.append(None)
+                self.expected = self.expected + 1
                 self.patches[lmsg.counter] = lmsg
+                self.patches[lmsg.counter + 1] = omsg
         else:
             self.patches[lmsg.counter] = lmsg
         self.complete = not (None in self.patches[1:])

---
base-commit: 433a845ce33f33c2ded6875447bf18e186ea1865
change-id: 20231207-series-from-non-reply-reply-110e4881ba0f

Best regards,
-- 
Ira Weiny <ira.weiny@intel.com>


             reply	other threads:[~2023-12-08  5:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  5:42 Ira Weiny [this message]
2023-12-08  5:55 ` [PATCH b4] am: Build patch series when additional patches appear in a thread Dan Williams
2024-01-23 23:10 ` Konstantin Ryabitsev

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=20231207-series-from-non-reply-reply-v1-1-cb02de53857c@intel.com \
    --to=ira.weiny@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=rrichter@amd.com \
    --cc=tools@linux.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 read-only IMAP folder(s) and NNTP newsgroup(s).