Re: [PATCHv15 2/5] run_processes_parallel: add LF when caller is sloppy
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 24, 2016, 21:23 UTC
- Message-ID
- <xmqqtwkxsszl.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAGZ79kYv-dKMnON=Hj2fUNEbUXz=8ti3x3tNG2WxWmdr5CA2tA@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 17 quoted lines
> On Wed, Feb 24, 2016 at 12:07 PM, Junio C Hamano <gitster@pobox.com> wrote: >> 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? > > What is the right thing? I asked myself and obviously it is treating the > child->err the same in both cases of checking for a trailing LF and > when outputting. > > But what is the right way to look at child->err? I would argue that > we should allow for children to have a NUL in its output stream and > replay their output as literal as possible. > > i.e. my conclusion is to replace the fputs by fwrite as opposed to > using strlen to determine the length of string output.
Yup, that is what I meant; sorry if I were too oblique.
There are two fputs() that assumes there is no embedded NUL around there, by the way.
Thanks.