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

Re: [PATCH] transport-helper: add trailing --

From
Jeff King <peff@peff.net>
Date
May 15, 2014, 09:00 UTC
Message-ID
<20140515090013.GB27033@sigill.intra.peff.net>
In-Reply-To
<20140515053214.GA12133@camelia.ucw.cz>
On Thu, May 15, 2014 at 07:32:14AM +0200, Stepan Kasal wrote:
Show 12 quoted lines
> From: Sverre Rabbelier <srabbelier@gmail.com>
> Date: Sat, 28 Aug 2010 20:49:01 -0500
> 
> [PT: ensure we add an additional element to the argv array]
> 
> Signed-off-by: Stepan Kasal <kasal@ucw.cz>
> ---
> 
> Hi,
>   this patch was present in msysgit from Mar 2012.
> Do you like it?
> I'm sorry, there is no author signoff; is the patch small enough?

It needs an explanation in the commit message, too. As Felipe noted, I do not think it would help with ambiguity, but it should not hurt, and is a reasonable defensive thing to do (but I did not think about it too long, so maybe Sverre has an example that needs it).

Show 10 quoted lines
> diff --git a/transport-helper.c b/transport-helper.c
> index 0e7c330..a01ea47 100644
> --- a/transport-helper.c
> +++ b/transport-helper.c
> @@ -429,7 +429,7 @@ static int get_exporter(struct transport *transport,
>  	/* we need to duplicate helper->in because we want to use it after
>  	 * fastexport is done with it. */
>  	fastexport->out = dup(helper->in);
> -	fastexport->argv = xcalloc(6 + revlist_args->nr, sizeof(*fastexport->argv));
> +	fastexport->argv = xcalloc(7 + revlist_args->nr, sizeof(*fastexport->argv));

It would be nice if this were an argv_array so we would not have to worry about managing the array size. This is one of several spots that leaks array memory that I have been meaning to fix.

I just posted a series that addresses those leaks and converts this site. I do not want to hold your patch hostage to my series, but depending on the review on my series, you may want to re-roll this on top; you would drop the line above, and change:

> +	fastexport->argv[argc++] = "--";
to:
    argv_array_push(&fastexport->args, "--");
-Peff
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Felipe ContrerasNext: Stepan Kasal
Message 3 of 6 in “transport-helper: add trailing --”
  1. transport-helper: add trailing --Stepan Kasal, May 15, 2014
  2. Felipe ContrerasMay 15, 2014
  3. Jeff KingMay 15, 2014
  4. Stepan KasalMay 15, 2014
  5. Johannes SchindelinMay 15, 2014
  6. Felipe ContrerasMay 16, 2014

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.