Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 "Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: [PATCH b4 1/2] review-tui: don't gpg-sign throwaway test-apply commits
Date: Thu, 23 Jul 2026 10:33:35 +0200	[thread overview]
Message-ID: <20260723-work-b4-testapply-nosign-v1-1-a7cb7105e06f@kernel.org> (raw)
In-Reply-To: <20260723-work-b4-testapply-nosign-v1-0-a7cb7105e06f@kernel.org>

The take/rebase/target/base modals check whether a series applies
cleanly by running a real git-am into a temporary worktree and rebase
additionally probes with a cherry-pick. The four modal probes run from
worker threads while the TUI keeps the terminal.

With commit.gpgsign=true and pinentry-curses git tries to sign every
probe commit. pinentry then pops up on the tty that Textual owns in raw
mode. The TUI repaints over the PIN dialog and its input reader swallows
the keystrokes and so gpg never gets the PIN and the apply hangs. With a
card-backed key this reproduces on every take.

The probe commits are discarded together with the temporary worktree
so signing them is pure waste. Let's pass -c commit.gpgsign=false to all
five probes. The rebase cherry-pick runs under suspend() and so cannot
deadlock. But its commits are just as throwaway. Real applies (checkout,
take, rebase, merge) are unaffected. They run with the TUI suspended,
where pinentry works, and keep signing per the user's configuration.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
 src/b4/review_tui/_modals.py       | 20 ++++++++++++++++----
 src/b4/review_tui/_tracking_app.py |  7 ++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/b4/review_tui/_modals.py b/src/b4/review_tui/_modals.py
index 51e6b4e..0a0c943 100644
--- a/src/b4/review_tui/_modals.py
+++ b/src/b4/review_tui/_modals.py
@@ -1066,7 +1066,10 @@ class TakeConfirmScreen(ModalScreen[bool]):
                     ecode, out = b4.git_run_command(gwt, ['checkout', '-f'])
                     if ecode > 0:
                         return False, 'failed to checkout base'
-                    ecode, out = b4.git_run_command(gwt, ['am'], stdin=ambytes)
+                    # No signing: gpg would prompt while the TUI owns the tty.
+                    ecode, out = b4.git_run_command(
+                        gwt, ['-c', 'commit.gpgsign=false', 'am'], stdin=ambytes
+                    )
                     if ecode > 0:
                         for line in out.splitlines():
                             if line.startswith('Patch failed at '):
@@ -2057,7 +2060,10 @@ class RebaseScreen(ModalScreen[bool]):
                     ecode, out = b4.git_run_command(gwt, ['checkout', '-f'])
                     if ecode > 0:
                         return False, 'failed to checkout base'
-                    ecode, out = b4.git_run_command(gwt, ['am'], stdin=ambytes)
+                    # No signing: gpg would prompt while the TUI owns the tty.
+                    ecode, out = b4.git_run_command(
+                        gwt, ['-c', 'commit.gpgsign=false', 'am'], stdin=ambytes
+                    )
                     if ecode > 0:
                         for line in out.splitlines():
                             if line.startswith('Patch failed at '):
@@ -2327,7 +2333,10 @@ class TargetBranchScreen(ModalScreen[Optional[str]]):
                     ecode, out = b4.git_run_command(gwt, ['checkout', '-f'])
                     if ecode > 0:
                         return False, 'failed to checkout base'
-                    ecode, out = b4.git_run_command(gwt, ['am'], stdin=ambytes)
+                    # No signing: gpg would prompt while the TUI owns the tty.
+                    ecode, out = b4.git_run_command(
+                        gwt, ['-c', 'commit.gpgsign=false', 'am'], stdin=ambytes
+                    )
                     if ecode > 0:
                         for line in out.splitlines():
                             if line.startswith('Patch failed at '):
@@ -3044,7 +3053,10 @@ class BaseSelectionScreen(ModalScreen[Optional[str]]):
                     ecode, out = b4.git_run_command(gwt, ['checkout', '-f'])
                     if ecode > 0:
                         return False, 'failed to checkout base'
-                    ecode, out = b4.git_run_command(gwt, ['am'], stdin=ambytes)
+                    # No signing: gpg would prompt while the TUI owns the tty.
+                    ecode, out = b4.git_run_command(
+                        gwt, ['-c', 'commit.gpgsign=false', 'am'], stdin=ambytes
+                    )
                     if ecode > 0:
                         # Extract just the "Patch failed" line
                         for line in out.splitlines():
diff --git a/src/b4/review_tui/_tracking_app.py b/src/b4/review_tui/_tracking_app.py
index 7e7f142..594ecef 100644
--- a/src/b4/review_tui/_tracking_app.py
+++ b/src/b4/review_tui/_tracking_app.py
@@ -3310,7 +3310,12 @@ class TrackingApp(LoreNodeShutdownMixin, CheckRunnerMixin, App[Optional[str]]):
                     )
 
                 # Try cherry-picking the commits
-                gitargs = ['cherry-pick', f'{base_commit}..{series_tip}']
+                gitargs = [
+                    '-c',
+                    'commit.gpgsign=false',
+                    'cherry-pick',
+                    f'{base_commit}..{series_tip}',
+                ]
                 ecode, out = b4.git_run_command(gwt, gitargs, logstderr=True)
                 if ecode != 0:
                     logger.warning('Series does not apply cleanly to %s', target_branch)

-- 
2.53.0


  reply	other threads:[~2026-07-23  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  8:33 [PATCH b4 0/2] review-tui: don't gpg-sign throwaway test-apply commits Christian Brauner
2026-07-23  8:33 ` Christian Brauner [this message]
2026-07-23  8:33 ` [PATCH b4 2/2] tests: guard the test-apply probes against gpg signing Christian Brauner
2026-07-23 15:33 ` [PATCH b4 0/2] review-tui: don't gpg-sign throwaway test-apply commits Nicolas Schier

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=20260723-work-b4-testapply-nosign-v1-1-a7cb7105e06f@kernel.org \
    --to=brauner@kernel.org \
    --cc=konstantin@linuxfoundation.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