user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/3] git-http-backend: avoid multi-arg print statemtents
Date: Thu, 25 Feb 2016 04:39:27 +0000	[thread overview]
Message-ID: <20160225043927.GA14671@dcvr.yhbt.net> (raw)
In-Reply-To: <20160225040237.29014-1-e@80x24.org>

Even with output buffering disabled via IO::Handle::autoflush,
writes are not atomic unless it is a single argument passed to
"print".  Multiple arguments to "print" will show up as multiple
calls to write(2) instead of a single, atomic writev(2).
---
 lib/PublicInbox/GitHTTPBackend.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 9c32535..5879970 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -139,7 +139,7 @@ sub serve_smart {
 		while (1) {
 			my $r = $input->read($buf, 8192);
 			unless (defined $r) {
-				$err->print('error reading input: ', $!, "\n");
+				$err->print("error reading input: $!\n");
 				return r(500);
 			}
 			last if ($r == 0);
@@ -150,12 +150,12 @@ sub serve_smart {
 	}
 	my ($rpipe, $wpipe);
 	unless (pipe($rpipe, $wpipe)) {
-		$err->print('error creating pipe', $!, "\n");
+		$err->print("error creating pipe: $!\n");
 		return r(500);
 	}
 	my $pid = fork; # TODO: vfork under Linux...
 	unless (defined $pid) {
-		$err->print('error forking: ', $!, "\n");
+		$err->print("error forking: $!\n");
 		return r(500);
 	}
 	my $git_dir = $git->{git_dir};
-- 
EW


      parent reply	other threads:[~2016-02-25  4:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25  4:02 [PATCH 0/3] migrate git-http-backend to async use Eric Wong
2016-02-25  4:02 ` [PATCH 1/3] use pipe for git-http-backend output Eric Wong
2016-02-25  4:02 ` [PATCH 2/3] git-http-backend: start refactoring to use callback Eric Wong
2016-02-25  4:02 ` [PATCH 3/3] git-http-backend: start async API for streaming Eric Wong
2016-02-25  4:30   ` [PATCH v2] " Eric Wong
2016-02-25  4:39 ` Eric Wong [this message]

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: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160225043927.GA14671@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /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/public-inbox.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).