git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Peart <peartben@gmail.com>
To: Christian Couder <christian.couder@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Ben Peart <Ben.Peart@microsoft.com>,
	Jonathan Tan <jonathantanmy@google.com>,
	Lars Schneider <larsxschneider@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH] sub-process: print the cmd when a capability is unsupported
Date: Tue, 15 Aug 2017 15:01:15 -0400	[thread overview]
Message-ID: <b9a458ca-6e4a-1ef2-79e1-f2a3e6d0a665@gmail.com> (raw)
In-Reply-To: <20170815173611.2267-1-chriscool@tuxfamily.org>



On 8/15/2017 1:36 PM, Christian Couder wrote:
> In handshake_capabilities() we use warning() when a capability
> is not supported, so the exit code of the function is 0 and no
> further error is shown. This is a problem because the warning
> message doesn't tell us which subprocess cmd failed.
> 
> On the contrary if we cannot write a packet from this function,
> we use error() and then subprocess_start() outputs:
> 
>      initialization for subprocess '<cmd>' failed
> 
> so we can know which subprocess cmd failed.
> 
> Let's improve the warning() message, so that we can know which
> subprocess cmd failed.
> 
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>   sub-process.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/sub-process.c b/sub-process.c
> index 6edb97c1c6..6b133f8dce 100644
> --- a/sub-process.c
> +++ b/sub-process.c
> @@ -158,7 +158,8 @@ static int handshake_version(struct child_process *process,
>   
>   static int handshake_capabilities(struct child_process *process,
>   				  struct subprocess_capability *capabilities,
> -				  unsigned int *supported_capabilities)
> +				  unsigned int *supported_capabilities,
> +				  const char *cmd)
>   {
>   	int i;
>   	char *line;
> @@ -184,8 +185,8 @@ static int handshake_capabilities(struct child_process *process,
>   			if (supported_capabilities)
>   				*supported_capabilities |= capabilities[i].flag;
>   		} else {
> -			warning("external filter requested unsupported filter capability '%s'",
> -				p);
> +			warning("subprocess '%s' requested unsupported capability '%s'",
> +				cmd, p);
>   		}
>   	}
>   
> @@ -206,8 +207,10 @@ int subprocess_handshake(struct subprocess_entry *entry,
>   
>   	retval = handshake_version(process, welcome_prefix, versions,
>   				   chosen_version) ||
> -		 handshake_capabilities(process, capabilities,
> -					supported_capabilities);
> +		 handshake_capabilities(process,
> +					capabilities,
> +					supported_capabilities,
> +					entry->cmd);
>   
>   	sigchain_pop(SIGPIPE);
>   	return retval;
> 

Looks good to me.


      parent reply	other threads:[~2017-08-15 19:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 17:36 [PATCH] sub-process: print the cmd when a capability is unsupported Christian Couder
2017-08-15 18:17 ` Jonathan Tan
2017-08-16  0:22   ` Jonathan Nieder
2017-08-16 12:37     ` Christian Couder
2017-08-16 15:58       ` Junio C Hamano
2017-08-17  5:34         ` Christian Couder
2017-08-17 21:01           ` Junio C Hamano
2017-08-17 21:34             ` Lars Schneider
2017-08-17 21:49               ` Jonathan Tan
2017-08-15 19:00 ` Lars Schneider
2017-08-15 19:26   ` Junio C Hamano
2017-08-15 19:29   ` Christian Couder
2017-08-15 19:32     ` Christian Couder
2017-08-15 19:35     ` Lars Schneider
2017-08-15 20:30       ` Christian Couder
2017-08-15 19:01 ` Ben Peart [this message]

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=b9a458ca-6e4a-1ef2-79e1-f2a3e6d0a665@gmail.com \
    --to=peartben@gmail.com \
    --cc=Ben.Peart@microsoft.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=larsxschneider@gmail.com \
    --cc=peff@peff.net \
    /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).