From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, jrnieder@gmail.com, Jens.Lehmann@web.de,
peff@peff.net, sunshine@sunshineco.com
Subject: Re: [PATCHv15 2/5] run_processes_parallel: add LF when caller is sloppy
Date: Wed, 24 Feb 2016 12:07:37 -0800 [thread overview]
Message-ID: <xmqqa8mpub1y.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1456284017-26141-3-git-send-email-sbeller@google.com> (Stefan Beller's message of "Tue, 23 Feb 2016 19:20:14 -0800")
Stefan Beller <sbeller@google.com> writes:
> @@ -1095,9 +1098,11 @@ static void pp_buffer_stderr(struct parallel_processes *pp, int output_timeout)
> static void pp_output(struct parallel_processes *pp)
> {
> int i = pp->output_owner;
> - if (pp->children[i].state == GIT_CP_WORKING &&
> - pp->children[i].err.len) {
> + size_t len = pp->children[i].err.len;
> + if (pp->children[i].state == GIT_CP_WORKING && len) {
> fputs(pp->children[i].err.buf, stderr);
> + pp->ended_with_newline =
> + (pp->children[i].err.buf[len - 1] == '\n');
> strbuf_reset(&pp->children[i].err);
> }
> }
The child->err thing is treated as a counted byte array when the
code determines where the end of the buffer is, but is treated as a
nul-terminated string when it is output with fputs().
The inconsistency may not hurt as long as (1) the producers of the
message will never stuff a NUL in the middle, and (2) strbuf always
has the guard NUL after its contents. Even though we know that the
latter will hold true for the foreseeable future, it also is easy to
do the right thing here, too, so why not?
next prev parent reply other threads:[~2016-02-24 20:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 3:20 [PATCHv15 0/5] Expose submodule parallelism to the user Stefan Beller
2016-02-24 3:20 ` [PATCHv15 1/5] run-command: expose default_{start_failure, task_finished} Stefan Beller
2016-02-24 3:20 ` [PATCHv15 2/5] run_processes_parallel: add LF when caller is sloppy Stefan Beller
2016-02-24 20:07 ` Junio C Hamano [this message]
2016-02-24 21:19 ` Stefan Beller
2016-02-24 21:23 ` Junio C Hamano
2016-02-24 21:19 ` Jonathan Nieder
2016-02-24 21:59 ` Stefan Beller
2016-02-25 0:55 ` Jonathan Nieder
2016-02-25 2:56 ` Junio C Hamano
2016-02-24 3:20 ` [PATCHv15 3/5] git submodule update: have a dedicated helper for cloning Stefan Beller
2016-02-24 3:20 ` [PATCHv15 4/5] submodule update: expose parallelism to the user Stefan Beller
2016-02-24 3:20 ` [PATCHv15 5/5] clone: allow an explicit argument for parallel submodule clones Stefan Beller
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=xmqqa8mpub1y.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.