From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Stefan Beller <sbeller@google.com>,
Git Mailing List <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Johannes Schindelin <johannes.schindelin@gmail.com>,
Jens Lehmann <Jens.Lehmann@web.de>,
Vitali Lovich <vlovich@gmail.com>
Subject: Re: [PATCH 01/10] strbuf: Add strbuf_read_noblock
Date: Thu, 17 Sep 2015 12:57:24 -0400 [thread overview]
Message-ID: <20150917165724.GA27102@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPc5daVY=t27wkX2x7DSfObwxZuv37VYxi1XD-RKiS1mv4=6KA@mail.gmail.com>
On Thu, Sep 17, 2015 at 09:44:19AM -0700, Junio C Hamano wrote:
> > Arguably we should actually return the number of bytes we _did_ read,
> > but then caller cannot easily tell the difference between EOF and
> > EAGAIN.
>
> Why can't it check errno==EAGAIN/EWOULDBLOCK?
Is it trustworthy to check errno if read() has not actually ever
returned -1? E.g., consider this sequence:
1. somebody (maybe even us calling strbuf_read) calls read() and it
returns -1, setting errno to EAGAIN
2. we call strbuf_read()
2a. it calls read(), which returns N bytes
2b. it calls read() again, which returns 0 for EOF
2c. it returns N, because that's how many bytes it read
3. we wonder if we hit EOF, or if we simply need to read again. We
check errno == EAGAIN
I don't think the read calls in step 2 are guaranteed to clear errno,
and we might read the cruft from step 1.
-Peff
next prev parent reply other threads:[~2015-09-17 16:57 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 1:38 [PATCH 00/10] fetch submodules in parallel and a preview on parallel "submodule update" Stefan Beller
2015-09-17 1:38 ` [PATCH 01/10] strbuf: Add strbuf_read_noblock Stefan Beller
2015-09-17 16:13 ` Junio C Hamano
2015-09-17 16:30 ` Jeff King
2015-09-17 16:44 ` Junio C Hamano
2015-09-17 16:51 ` Stefan Beller
2015-09-17 16:57 ` Jeff King [this message]
2015-09-17 16:58 ` Junio C Hamano
2015-09-17 17:13 ` Jeff King
2015-09-17 17:26 ` Stefan Beller
2015-09-17 17:35 ` Jeff King
2015-09-17 17:45 ` Stefan Beller
2015-09-17 17:50 ` Jeff King
2015-09-17 17:53 ` Stefan Beller
2015-09-17 17:57 ` Junio C Hamano
2015-09-17 17:54 ` Junio C Hamano
2015-09-17 18:02 ` Jeff King
2015-09-17 17:20 ` Stefan Beller
2015-09-17 1:39 ` [PATCH 02/10] run-command: factor out return value computation Stefan Beller
2015-09-17 10:33 ` Jeff King
2015-09-17 1:39 ` [PATCH 03/10] run-command: add an asynchronous parallel child processor Stefan Beller
2015-09-17 21:44 ` Junio C Hamano
2015-09-17 23:19 ` Stefan Beller
2015-09-18 1:05 ` Junio C Hamano
2015-09-18 16:36 ` Stefan Beller
2015-09-17 1:39 ` [PATCH 04/10] fetch_populated_submodules: use new parallel job processing Stefan Beller
2015-09-17 1:39 ` [PATCH 05/10] submodules: Allow parallel fetching, add tests and documentation Stefan Beller
2015-09-17 1:39 ` [PATCH 06/10] git submodule update: Redirect any output to stderr Stefan Beller
2015-09-17 20:31 ` Eric Sunshine
2015-09-17 20:38 ` Stefan Beller
2015-09-17 1:39 ` [PATCH 07/10] git submodule update: pass --prefix only with a non empty prefix Stefan Beller
2015-09-17 20:33 ` Eric Sunshine
2015-09-17 1:39 ` [PATCH 08/10] git submodule update: cmd_update_recursive Stefan Beller
2015-09-17 1:39 ` [PATCH 09/10] " Stefan Beller
2015-09-17 20:37 ` Eric Sunshine
2015-09-17 1:39 ` [PATCH 10/10] git submodule update: cmd_update_fetch Stefan Beller
2015-09-17 17:06 ` [PATCH 00/10] fetch submodules in parallel and a preview on parallel "submodule update" Jacob Keller
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=20150917165724.GA27102@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmail.com \
--cc=jrnieder@gmail.com \
--cc=sbeller@google.com \
--cc=vlovich@gmail.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).