From: Jeff King <peff@peff.net>
To: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC 4/4] Add cat-blob report pipe from fast-import to remote-helper.
Date: Tue, 5 Jun 2012 02:56:28 -0400 [thread overview]
Message-ID: <20120605065628.GA25809@sigill.intra.peff.net> (raw)
In-Reply-To: <1338830455-3091-5-git-send-email-florian.achleitner.2.6.31@gmail.com>
On Mon, Jun 04, 2012 at 07:20:55PM +0200, Florian Achleitner wrote:
> On invocation of a helper a new pipe is opened.
> To close the other end after fork, the prexec_cb feature
> of the run_command api is used.
> If the helper is not used with fast-import later the pipe
> is unused.
> The FD is passed to the remote-helper via it's environment,
> helpers that don't use fast-import can simply ignore it.
> fast-import has an argv for that.
I don't keep up on fast-import development, so I have no clue how useful
this extra pipe is, or whether this patch is a good idea overall. But a
few comments on the transport.c half of things:
> +static int fd_to_close;
> +void close_fd_prexec_cb(void)
> +{
> + if(debug)
> + fprintf(stderr, "close_fd_prexec_cb closing %d\n", fd_to_close);
> + close(fd_to_close);
> +}
Note that preexec_cb does not work at all on Windows, as it assumes a
forking model (rather than a spawn, which leaves no room to execute
arbitrary code in the child). If all you want to do is open an extra
pipe, then probably run-command should be extended to handle this
(though I have no idea how complex that would be for the Windows side of
things, it is at least _possible_, as opposed to preexec_cb, which will
never be possible).
> @@ -376,13 +411,20 @@ static int fetch_with_fetch(struct transport *transport,
> static int get_importer(struct transport *transport, struct child_process *fastimport)
> {
> struct child_process *helper = get_helper(transport);
> + struct helper_data *data = transport->data;
> + struct strbuf buf = STRBUF_INIT;
> memset(fastimport, 0, sizeof(*fastimport));
> fastimport->in = helper->out;
> fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));
> fastimport->argv[0] = "fast-import";
> fastimport->argv[1] = "--quiet";
> + strbuf_addf(&buf, "--cat-blob-fd=%d", data->fast_import_backchannel_pipe[1]);
> + fastimport->argv[2] = strbuf_detach(&buf, NULL);
Consider converting this to use argv_array. You can drop the magic
numbers, and "argv_array_pushf" handles the strbuf bits for you
automatically.
And this grossness can go away:
> @@ -441,6 +488,7 @@ static int fetch_with_import(struct transport *transport,
>
> if (finish_command(&fastimport))
> die("Error while running fast-import");
> + free((void*)fastimport.argv[2]);
> free(fastimport.argv);
> fastimport.argv = NULL;
(you'd instead want to free everything; it would probably make sense to
add an argv_array_free_detached() function to do so).
> @@ -427,6 +469,11 @@ static int fetch_with_import(struct transport *transport,
> if (get_importer(transport, &fastimport))
> die("Couldn't run fast-import");
>
> +
> + /* in the parent process we close both pipe ends. */
> + close(data->fast_import_backchannel_pipe[0]);
> + close(data->fast_import_backchannel_pipe[1]);
I'm confused. We close both ends? Who is actually reading and writing to
this pipe, then?
-Peff
next prev parent reply other threads:[~2012-06-05 6:56 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-04 17:20 [RFC 0/4] Florian Achleitner
2012-06-04 17:20 ` [RFC 1/4] Implement a basic remote helper vor svn in C Florian Achleitner
2012-06-04 17:20 ` [RFC 2/4] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2012-06-04 17:20 ` [RFC 3/4] Add svndump_init_fd to allow reading dumps from arbitrary FDs Florian Achleitner
2012-06-04 17:20 ` [RFC 4/4] Add cat-blob report pipe from fast-import to remote-helper Florian Achleitner
2012-06-05 1:33 ` David Michael Barr
2012-06-05 6:56 ` Jeff King [this message]
2012-06-05 7:07 ` David Michael Barr
2012-06-05 8:14 ` Jeff King
2012-06-05 22:16 ` Florian Achleitner
2012-06-06 13:43 ` Jeff King
2012-06-06 21:04 ` Florian Achleitner
2012-06-05 8:51 ` Johannes Sixt
2012-06-05 9:07 ` Jeff King
2012-06-05 22:17 ` Florian Achleitner
2012-06-05 9:09 ` Johannes Sixt
2012-06-05 1:21 ` [RFC 3/4] Add svndump_init_fd to allow reading dumps from arbitrary FDs David Michael Barr
2012-06-29 7:49 ` [RFC 0/4 v2] Florian Achleitner
2012-06-29 7:54 ` [RFC 1/4 v2] Implement a basic remote helper for svn in C Florian Achleitner
2012-07-02 11:07 ` Jonathan Nieder
2012-07-06 0:30 ` Jonathan Nieder
2012-07-06 10:39 ` Florian Achleitner
2012-07-26 8:31 ` Florian Achleitner
2012-07-26 9:08 ` Jonathan Nieder
2012-07-26 16:16 ` Florian Achleitner
2012-07-28 7:00 ` Jonathan Nieder
2012-07-30 8:12 ` Florian Achleitner
2012-07-30 8:29 ` Jonathan Nieder
2012-07-30 13:55 ` Florian Achleitner
2012-07-30 16:55 ` Jonathan Nieder
2012-07-31 19:31 ` Florian Achleitner
2012-07-31 22:43 ` Jonathan Nieder
2012-08-01 8:25 ` Florian Achleitner
2012-08-01 19:42 ` Jonathan Nieder
2012-08-12 10:06 ` Florian Achleitner
2012-08-12 16:12 ` Jonathan Nieder
2012-08-12 19:39 ` Florian Achleitner
2012-08-12 20:10 ` Jonathan Nieder
2012-08-12 19:36 ` Jonathan Nieder
2012-07-26 17:29 ` Junio C Hamano
2012-07-30 8:12 ` Florian Achleitner
2012-07-26 9:45 ` Steven Michalske
[not found] ` <358E6F1E-8BAD-4F82-B270-0233AB86EF66@gmail.com>
2012-07-26 11:40 ` Jonathan Nieder
2012-07-26 14:28 ` Florian Achleitner
2012-07-26 14:54 ` Jonathan Nieder
2012-07-27 7:23 ` Florian Achleitner
2012-07-28 6:54 ` Jonathan Nieder
2012-06-29 7:58 ` [RFC 2/4 v2] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2012-06-29 7:59 ` [RFC 3/4 v2] Add svndump_init_fd to allow reading dumps from arbitrary FDs Florian Achleitner
2012-06-29 8:00 ` [RFC 4/4 v2] Add cat-blob report fifo from fast-import to remote-helper Florian Achleitner
2012-07-21 12:45 ` [RFC 4/4 v3] " Florian Achleitner
2012-07-21 14:48 ` Jonathan Nieder
2012-07-21 15:24 ` Florian Achleitner
2012-07-21 15:44 ` Jonathan Nieder
2012-07-22 21:03 ` Florian Achleitner
2012-07-22 21:24 ` Jonathan Nieder
2012-07-21 15:58 ` Jonathan Nieder
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120605065628.GA25809@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=florian.achleitner.2.6.31@gmail.com \
--cc=git@vger.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).