git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] sub-process: print the cmd when a capability is unsupported

From
Ben Peart <peartben@gmail.com>
Date
Aug 16, 2017, 14:06 UTC
Message-ID
<758d36a7-8066-7e1a-30d0-62baf2796520@gmail.com>
In-Reply-To
<20170816124036.25236-1-chriscool@tuxfamily.org>
On 8/16/2017 8:40 AM, Christian Couder wrote:
Show 42 quoted lines
> 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.
> 
> Helped-by: Lars Schneider <larsxschneider@gmail.com>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> Change since previous version:
> 
>    - Use process->argv[0] instead of adding a new parameter to
>      handshake_capabilities(), thanks to Lars.
> 
>   sub-process.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sub-process.c b/sub-process.c
> index 6edb97c1c6..6ccfaaba99 100644
> --- a/sub-process.c
> +++ b/sub-process.c
> @@ -184,8 +184,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'",
> +				process->argv[0], p);
>   		}
>   	}
>   
> 

This one is even cleaner. Thanks Lars for pointing out the fact we already had the cmd name. Looks good.

Previous: Christian CouderNext: Junio C Hamano
Message 2 of 8 in “sub-process: print the cmd when a capability is unsupported”
  1. sub-process: print the cmd when a capability is unsupportedChristian Couder, Aug 16, 2017
  2. Ben PeartAug 16, 2017
  3. Junio C HamanoAug 16, 2017
  4. Junio C HamanoAug 16, 2017
  5. Junio C HamanoSep 11, 2017
  6. Ben PeartSep 11, 2017
  7. Lars SchneiderSep 12, 2017
  8. Lars SchneiderAug 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.