List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH] ui-patch: Flush stdout after outputting data
Date: Wed, 11 Jun 2014 21:55:19 +0100	[thread overview]
Message-ID: <20140611205519.GB28807@serenity.lan> (raw)
In-Reply-To: <5398BBEA.8090002@kernel.org>

On Wed, Jun 11, 2014 at 04:28:26PM -0400, Konstantin Ryabitsev wrote:
> On 11/06/14 04:01 PM, John Keeping wrote:
> > Since the "html" functions use raw write(2) to STDIO_FILENO, we don't
> > notice problems with most pages, but raw patches write using printf(3).
> > This is fine if we're outputting straight to stdout since the buffers
> > are flushed on exit, but we close the cache output before this, so the
> > cached output ends up being truncated.

Actually, it's slightly more interesting than this... since we don't set
GIT_FLUSH, Git decides whether or not it will flush stdout after writing
each commit based on whether or not stdout points to a regular file (in
maybe_flush_or_die()).

Which means that when writing directly to the webserver, Git flushes
stdout for us, but when we redirect stdout to the cache it points to a
regular file so Git no longer flushes the output for us.

The patch is still correct, but perhaps the full explanation is
interesting!


  reply	other threads:[~2014-06-11 20:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 19:46 Cache bug: cached patches truncated to nearest 1024-byte boundary mricon
2014-06-11 20:01 ` [PATCH] ui-patch: Flush stdout after outputting data john
2014-06-11 20:28   ` mricon
2014-06-11 20:55     ` john [this message]
2014-06-28 13:59       ` Jason

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=20140611205519.GB28807@serenity.lan \
    --to=cgit@lists.zx2c4.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).