All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] gpg-interface: reflect stderr to stderr
Date: Tue,  6 Sep 2016 15:13:03 +0200	[thread overview]
Message-ID: <18a7e2984121d988137c135ec560fee56506981b.1473167263.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <ced7502d-0095-bd90-19e3-c14d0e4d4f07@drmicha.warpmail.net>

efee955 ("gpg-interface: check gpg signature creation status",
2016-06-17) used stderr to capture gpg's status output, which is the
only reliable way for status checks. As a side effect, stderr was not
shown to the user any more.

In case of a gpg error, reflect the whole captured buffer to stderr.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
A full blown approach would use --status-fd=4 or such rather than hijacking stderr.
This would require an extension of pipe_command() etc. to handle yet another fd.

 gpg-interface.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gpg-interface.c b/gpg-interface.c
index 8672eda..cf35bca 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -173,9 +173,12 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
 	sigchain_pop(SIGPIPE);
 
 	ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED ");
-	strbuf_release(&gpg_status);
-	if (ret)
+	if (ret) {
+		fputs(gpg_status.buf, stderr);
+		strbuf_release(&gpg_status);
 		return error(_("gpg failed to sign the data"));
+	}
+	strbuf_release(&gpg_status);
 
 	/* Strip CR from the line endings, in case we are on Windows. */
 	for (i = j = bottom; i < signature->len; i++)
-- 
2.10.0.rc2.333.g8ef2d05


  reply	other threads:[~2016-09-06 13:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  8:01 [PATCH] Unbreak interactive GPG prompt upon signing Johannes Schindelin
2016-09-06 12:32 ` Michael J Gruber
2016-09-06 13:13   ` Michael J Gruber [this message]
2016-09-06 16:30     ` [PATCH] gpg-interface: reflect stderr to stderr Johannes Schindelin
2016-09-06 16:42       ` Johannes Schindelin
2016-09-06 16:43         ` Johannes Schindelin
2016-09-07  8:27           ` Michael J Gruber
2016-09-07  8:39             ` Jeff King
2016-09-07  9:32               ` Michael J Gruber
2016-09-08 18:20               ` Junio C Hamano
2016-09-08 20:03                 ` Jeff King
2016-09-08 21:36                   ` Junio C Hamano
2016-09-12 13:39                     ` Michael J Gruber
2018-10-02 13:02                       ` Johannes Schindelin
2016-09-09  7:28                 ` Johannes Schindelin
2016-09-06 16:39   ` [PATCH] Unbreak interactive GPG prompt upon signing Johannes Schindelin

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=18a7e2984121d988137c135ec560fee56506981b.1473167263.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.