Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2200)

Issue 76400048: code review 76400048: bufio: fix bug that ReadFrom stops before EOF or error (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by ruiu
Modified:
9 years, 11 months ago
Reviewers:
gobot, smh, bradfitz
CC:
golang-codereviews
Visibility:
Public.

Description

bufio: fix bug that ReadFrom stops before EOF or error ReadFrom should not return until it receives a non-nil error or too many contiguous (0, nil)s from a given reader. Currently it immediately returns if it receives one (0, nil). Fixes issue 7611.

Patch Set 1 #

Patch Set 2 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 3 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 4 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 5 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 6 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 7 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 8 : diff -r 62052ebe728b https://code.google.com/p/go #

Patch Set 9 : diff -r 62052ebe728b https://code.google.com/p/go #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -4 lines) Patch
M src/pkg/bufio/bufio.go View 1 2 3 4 5 6 7 2 chunks +11 lines, -3 lines 2 comments Download
M src/pkg/bufio/bufio_test.go View 1 2 3 4 1 chunk +54 lines, -0 lines 0 comments Download
M src/pkg/bufio/scan.go View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 20
ruiu
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 1 month ago (2014-03-24 06:23:13 UTC) #1
bradfitz
This looks like another place for io.ErrNoProgress. Count the number of contiguous (0, nil) Read ...
10 years, 1 month ago (2014-03-24 15:56:37 UTC) #2
ruiu
Is that the right thing to do? The manual of io.ReaderFrom does say that it ...
10 years, 1 month ago (2014-03-24 16:58:50 UTC) #3
bradfitz
On Mon, Mar 24, 2014 at 9:58 AM, <ruiu@google.com> wrote: > Is that the right ...
10 years, 1 month ago (2014-03-24 17:02:23 UTC) #4
ruiu
OK, if it's the policy, let's return io.ErrNoProgress on contiguous (0, nil). Both in crypto/tls/conn.go ...
10 years, 1 month ago (2014-03-24 17:41:20 UTC) #5
bradfitz
SGTM On Mon, Mar 24, 2014 at 10:41 AM, Rui Ueyama <ruiu@google.com> wrote: > OK, ...
10 years, 1 month ago (2014-03-24 17:42:08 UTC) #6
ruiu
Hello golang-codereviews@googlegroups.com, bradfitz@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
10 years, 1 month ago (2014-03-24 17:56:58 UTC) #7
bradfitz
Can't that 100 constant be shared between the different users of ErrNoProgress in bufio? On ...
10 years, 1 month ago (2014-03-24 17:59:01 UTC) #8
ruiu
Done. PTAL. On Mon, Mar 24, 2014 at 10:58 AM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > Can't ...
10 years, 1 month ago (2014-03-24 18:04:27 UTC) #9
ruiu
BTW, we may also want to modify text/scanner/scanner.go as Scanner.next loops forever if upstream reader ...
10 years, 1 month ago (2014-03-24 18:10:26 UTC) #10
bradfitz
Low priority anyway since approximately zero people use text/scanner. On Mar 24, 2014 11:10 AM, ...
10 years, 1 month ago (2014-03-24 18:18:28 UTC) #11
ruiu
I agree. I just wanted to mention that there are other places for ErrNoProgress and ...
10 years, 1 month ago (2014-03-24 18:23:09 UTC) #12
bradfitz
LGTM
10 years, 1 month ago (2014-03-24 18:48:28 UTC) #13
bradfitz
*** Submitted as https://code.google.com/p/go/source/detail?r=2e2908226d52 *** bufio: fix bug that ReadFrom stops before EOF or error ...
10 years, 1 month ago (2014-03-24 18:48:37 UTC) #14
gobot
This CL appears to have broken the windows-386-ec2 builder. See http://build.golang.org/log/861ff0e165467bbe2f0b602e2f6e586eae231f04
10 years, 1 month ago (2014-03-24 19:49:56 UTC) #15
smh
Would be good to make the max attempts configurable include infinite, even though this may ...
9 years, 11 months ago (2014-06-06 14:38:08 UTC) #16
bradfitz
https://codereview.appspot.com/76400048/diff/140001/src/pkg/bufio/bufio.go File src/pkg/bufio/bufio.go (right): https://codereview.appspot.com/76400048/diff/140001/src/pkg/bufio/bufio.go#newcode41 src/pkg/bufio/bufio.go:41: const maxConsecutiveEmptyReads = 100 On 2014/06/06 14:38:08, smh wrote: ...
9 years, 11 months ago (2014-06-06 15:12:27 UTC) #17
smh
The docs need to explicitly mention this behaviour as otherwise its going to catch people ...
9 years, 11 months ago (2014-06-06 16:02:56 UTC) #18
bradfitz
io.Reader already mentions not to return (0, nil) On Jun 6, 2014 9:02 AM, <steven.hartland@multiplay.co.uk> ...
9 years, 11 months ago (2014-06-06 16:11:59 UTC) #19
smh
9 years, 11 months ago (2014-06-06 16:20:23 UTC) #20
Message was sent while issue was closed.
On 2014/06/06 16:11:59, bradfitz wrote:
> io.Reader already mentions not to return (0, nil)

It mentions its not recommended it doesn't say it will break other core modules
like bufio after an a seemingly arbitrary limit.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b