Re: [PATCH v2] Refactor recv_sideband()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lukas Fleischer <lfleischer@xxxxxxx> writes:

> On Fri, 24 Jun 2016 at 20:32:28, Junio C Hamano wrote:
>> On Fri, Jun 24, 2016 at 11:14 AM, Jeff King <peff@xxxxxxxx> wrote:
>> >
>> > I do wonder about the ANSI_SUFFIX thing, though.
>> 
>> compat/winansi.c seems to have a provision for 'K' (and obviously 'm'
>> for colors).
>
> So we probably want to switch back to using fprintf() or fputs() and
> rely on the assumption that these functions use atomic write()
> operations internally when printing to stderr (on practically relevant
> systems, i.e., libc implementations), right?
>
> Another option is using write() on all systems but Windows and fall back
> on fputs() but that feels a bit like over-engineering at this point.

Wait a bit.

The original used to use one fprintf(stderr) per line it outputs.
That does not necessarily guarantee atomicity (i.e. the payload
string may be large and make stdio decide to do multiple writes).

The issue found in your first round (sent on Jun 13) was that you
did multiple fprintf(stderr) when showing a single line, which is
guaranteed to result in multiple writes because stderr is not
line-buffered.  But that was corrected in your second round.

It's just you used xwrite() there that introduced a different issue.
Wouldn't replacing it with fwrite(stderr) without changing anything
else solve that?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]