From: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>,
git@vger.kernel.org, David Michael Barr <davidbarr@google.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Jeff King <peff@peff.net>, Johannes Sixt <j.sixt@viscovery.net>
Subject: Re: [RFC 1/4 v2] Implement a basic remote helper for svn in C.
Date: Sun, 12 Aug 2012 21:39:35 +0200 [thread overview]
Message-ID: <2007117.uOeClQJdrW@flobuntu> (raw)
In-Reply-To: <20120812161258.GA3829@mannheim-rule.local>
On Sunday 12 August 2012 09:12:58 Jonathan Nieder wrote:
> Hi again,
>
> Florian Achleitner wrote:
> > back to the pipe-topic.
>
> Ok, thanks.
>
> [...]
>
> >> The way it's supposed to work is that in a bidi-import, the remote
> >> helper reads in the entire list of refs to be imported and only once
> >> the newline indicating that that list is over arrives starts writing
> >> its fast-import stream.
>
> [...]
>
> > This would require all existing remote helpers that use 'import' to be
> > ported to the new concept, right? Probably there is no other..
>
> You mean all existing remote helpers that use 'bidi-import', right?
> There are none.
Ok, it would not affect the existing import command.
>
> [...]
>
> > I still don't believe that sharing the input pipe of the remote helper is
> > worth the hazzle.
> > It still requires an additional pipe to be setup, the one from fast-import
> > to the remote-helper, sharing one FD at the remote helper.
>
> If I understand correctly, you misunderstood how sharing the input
> pipe works. Have you tried it?
Yes wrote a test program, sharing works, that's not the problem.
>
> It does not involve setting up an additional pipe. Standard input for
> the remote helper is already a pipe. That pipe is what allows
> transport-helper.c to communicate with the remote helper. Letting
> fast-import share that pipe involves passing that file descriptor to
> git fast-import. No additional pipe() calls.
>
> Do you mean that it would be too much work to implement? This
> explanation just doesn't make sense to me, given that the version
> using pipe() *already* *exists* and is *tested*.
Yes, that was the first version I wrote, and remote-svn-alpha uses.
>
> I get the feeling I am missing something very basic. I would welcome
> input from others that shows what I am missing.
>
This is how I see it, probably it's all wrong:
I thought the main problem is, that we don't want processes to have *more than
three pipes attached*, i.e. stdout, stdin, stderr, because existing APIs don't
allow it.
When we share stdin of the remote helper, we achieve this goal for this one
process, but fast-import still has an additional pipe:
stdout --> shell;
stderr --> shell;
stdin <-- remote-helper;
additional_pipe --> remote-helper.
That's what I wanted to say: We still have more than three pipes on fast-
import.
And we need to transfer that fourth file descriptor by inheritance and it's
number as a command line argument.
So if we make the remote-helper have only three pipes by double-using stdin,
but fast-import still has four pipes, what problem does it solve?
Using fifos would remove the requirement to inherit more than three pipes.
That's my point.
[..]
>
> Meanwhile it would:
>
> - be 100% functionally equivalent to the solution where fast-import
> writes directly to the remote helper's standard input. Two programs
> can have the same pipe open for writing at the same time for a few
> seconds and that is *perfectly fine*. On Unix and on Windows.
>
> On Windows the only complication with the pipe()-based is that we
> haven't wired up the low-level logic to pass file descriptors other than
> stdin, stdout, stderr to child processes; and if I have understood earlier
> messages correctly, the operating system *does* have a
> concept of that and this is just a todo item in msys
> implementation.
I digged into MSDN and it seems it's not a problem at all on the windows api
layer. Pipe handles can be inherited. [1]
If the low-level logic once supports passing more than 3 fds, it will work on
fast-import as well as remote-helper.
>
> - be more complicated than the code that already exists for this
> stuff.
>
> So while I presented this as a compromise, I don't see the point.
>
> Is your goal portability, a dislike of the interface, some
> implementation detail I have missed, or something else? Could you
> explain the problem as concisely but clearly as possible (perhaps
> using an example) so that others like Sverre, Peff, or David can help
> think through it and to explain it in a way that dim people like me
> understand what's going on?
It all started as portability-only discussion. On Linux, my first version would
have worked. It created an additional pipe before forking using pipe(). Runs
great, it did it like remote-svn-alpha.sh.
I wouldn't have started to produce something else or start a discussion on my
own. But I was told, it's not good because of portability. This is the root of
this endless story. (you already know the thread, I think). Since weeks nobody
of them is interested in that except you and me.
So if we accept having more than three pipes on a process, we have no more
problem.
We can dig out that first version, as well as write the one proposed by you.
While your version saves some trouble by not requiring an additional pipe()
call and not requiring the prexec_cb, but adding a little complexity with the
re-using of stdin.
Currently I have the implemented the original pipe version, the original fifo
version, the fifo version described a mail ago. I'm going to implement the
stdin-sharing version now..
[1] http://msdn.microsoft.com/en-
us/library/windows/desktop/aa365782(v=vs.85).aspx
>
> Puzzled,
> Jonathan
Piped,
Florian ;)
next prev parent reply other threads:[~2012-08-12 19:39 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2007117.uOeClQJdrW@flobuntu \
--to=florian.achleitner.2.6.31@gmail.com \
--cc=davidbarr@google.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=srabbelier@gmail.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 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).