From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Emily Shaffer <emilyshaffer@google.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Taylor Blau <me@ttaylorr.com>,
Michael Strawbridge <michael.strawbridge@amd.com>,
Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH v2 2/5] run-command: allow stdin for run_processes_parallel
Date: Wed, 08 Feb 2023 13:09:26 -0800 [thread overview]
Message-ID: <xmqq357frhix.fsf@gitster.g> (raw)
In-Reply-To: <patch-v2-2.5-9a178577dcc-20230208T191924Z-avarab@gmail.com> (=?utf-8?B?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Wed, 8 Feb 2023 20:21:12 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> From: Emily Shaffer <emilyshaffer@google.com>
>
> While it makes sense not to inherit stdin from the parent process to
> avoid deadlocking, it's not necessary to completely ban stdin to
> children.
I do not think deadlock avoidance is an issue. Unpredictable
feeding of pieces of input into multiple children is. One possible
semantics is to grab the input and dup/tee into all the children, so
that each child gets its own copy to process. A hook like "pre-receive",
when it has more than one scripts listening to the event, may want
such a semantics. Another possible semantics is to give priority
among the children running simultaneously and feed only one child,
while starving others.
> An informed user should be able to configure stdin safely. By
> setting `some_child.process.no_stdin=1` before calling `get_next_task()`
> we provide a reasonable default behavior but enable users to set up
> stdin streaming for themselves during the callback.
I _think_ this alludes to the latter, e.g. "only one child is
allowed, and the one that controls what children are spawned sets
no_stdin for everybody but the chosen one". We may want to be a bit
more explicit in the proposed log message and definitely in the
documentation.
The implementation is "nice".
> + /*
> + * By default, do not inherit stdin from the parent process - otherwise,
> + * all children would share stdin! Users may overwrite this to provide
> + * something to the child's stdin by having their 'get_next_task'
> + * callback assign 0 to .no_stdin and an appropriate integer to .in.
> + */
> + pp->children[i].process.no_stdin = 1;
> +
> code = opts->get_next_task(&pp->children[i].process,
> opts->ungroup ? NULL : &pp->children[i].err,
> opts->data,
> @@ -1601,7 +1609,6 @@ static int pp_start_one(struct parallel_processes *pp,
> pp->children[i].process.err = -1;
> pp->children[i].process.stdout_to_stderr = 1;
> }
> - pp->children[i].process.no_stdin = 1;
>
> if (start_command(&pp->children[i].process)) {
> if (opts->start_failure)
next prev parent reply other threads:[~2023-02-08 21:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 17:15 [PATCH 0/5] hook API: support stdin, convert post-rewrite Ævar Arnfjörð Bjarmason
2023-01-23 17:15 ` [PATCH 1/5] run-command.c: remove dead assignment in while-loop Ævar Arnfjörð Bjarmason
2023-01-23 22:48 ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 2/5] run-command: allow stdin for run_processes_parallel Ævar Arnfjörð Bjarmason
2023-01-23 22:52 ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 3/5] hook API: support passing stdin to hooks, convert am's 'post-rewrite' Ævar Arnfjörð Bjarmason
2023-01-23 23:10 ` Junio C Hamano
2023-01-23 23:13 ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 4/5] sequencer: use the new hook API for the simpler "post-rewrite" call Ævar Arnfjörð Bjarmason
2023-01-24 14:46 ` Phillip Wood
2023-01-27 15:08 ` Phillip Wood
2023-01-23 17:15 ` [PATCH 5/5] hook: support a --to-stdin=<path> option for testing Ævar Arnfjörð Bjarmason
2023-01-24 0:55 ` Junio C Hamano
2023-01-24 0:59 ` Michael Strawbridge
2023-02-08 19:21 ` [PATCH v2 0/5] hook API: support stdin, convert post-rewrite Ævar Arnfjörð Bjarmason
2023-02-08 19:21 ` [PATCH v2 1/5] run-command.c: remove dead assignment in while-loop Ævar Arnfjörð Bjarmason
2023-02-08 21:03 ` Junio C Hamano
2023-02-08 19:21 ` [PATCH v2 2/5] run-command: allow stdin for run_processes_parallel Ævar Arnfjörð Bjarmason
2023-02-08 21:09 ` Junio C Hamano [this message]
2023-02-08 19:21 ` [PATCH v2 3/5] hook API: support passing stdin to hooks, convert am's 'post-rewrite' Ævar Arnfjörð Bjarmason
2023-02-08 21:12 ` Junio C Hamano
2023-02-08 19:21 ` [PATCH v2 4/5] sequencer: use the new hook API for the simpler "post-rewrite" call Ævar Arnfjörð Bjarmason
2023-02-08 21:17 ` Junio C Hamano
2023-02-08 19:21 ` [PATCH v2 5/5] hook: support a --to-stdin=<path> option Ævar Arnfjörð Bjarmason
2023-02-08 21:22 ` Junio C Hamano
2023-02-09 1:56 ` Ævar Arnfjörð Bjarmason
2023-02-08 21:23 ` [PATCH v2 0/5] hook API: support stdin, convert post-rewrite Junio C Hamano
2023-02-03 12:15 Ævar Arnfjörð Bjarmason
2023-02-03 12:15 ` [PATCH v2 2/5] run-command: allow stdin for run_processes_parallel Ævar Arnfjörð Bjarmason
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=xmqq357frhix.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=michael.strawbridge@amd.com \
--cc=phillip.wood123@gmail.com \
--cc=sunshine@sunshineco.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.
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).