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

Issue 162062: code review 162062: Robustness fixes for tar/archive. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 3 months ago by cw
Modified:
15 years, 3 months ago
Reviewers:
CC:
rsc, dsymonds
Visibility:
Public.

Description

Robustness fixes for tar/archive. 1. If all data is exhausted using Read then a following Next will fail as if it saw EOF. A test case for this was added. It verifies the data using MD5. 2. Seeking isn't always possible (f.e. sockets and pipes). Fallback to read. A test case for this was added. 3. Fix to readHeader (cleaner fix pointed out by rsc). One of the test cases (TestReader) was modified to accommodate this. 4. When Read has consumed all the data, don't try and read 0 bytes from reader. In cases where tr.nb is zero we attempt to read zero bytes and thus never see an EOF (this is most easily seen when the 'tar source' is something like bytes.Buffer{} as opposed to os.File). 5. If write is used to the point of ErrWriteTooLong allow additional file entries. 6. Make close work as expected. That is any further Write or WriteHeader attempts will result in ErrWriteAfterClose.

Patch Set 1 #

Total comments: 5

Patch Set 2 : code review 162062: Minor fixes for tar/archive. #

Patch Set 3 : code review 162062: Minor fixes for tar/archive. #

Total comments: 4

Patch Set 4 : code review 162062: Minor fixes for tar/archive. #

Patch Set 5 : code review 162062: Minor fixes for tar/archive. #

Total comments: 4

Patch Set 6 : code review 162062: Minor fixes for tar/archive. #

Total comments: 7

Patch Set 7 : code review 162062: Robustness fixes for tar/archive. #

Total comments: 3

Patch Set 8 : code review 162062: Robustness fixes for tar/archive. #

Patch Set 9 : code review 162062: Robustness fixes for tar/archive. #

Patch Set 10 : code review 162062: Robustness fixes for tar/archive. #

Patch Set 11 : code review 162062: Robustness fixes for tar/archive. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+168 lines, -38 lines) Patch
M src/pkg/archive/tar/reader.go View 1 2 3 4 5 6 7 3 chunks +19 lines, -8 lines 0 comments Download
M src/pkg/archive/tar/reader_test.go View 1 2 3 4 5 6 7 8 9 4 chunks +134 lines, -27 lines 0 comments Download
M src/pkg/archive/tar/writer.go View 6 7 4 chunks +15 lines, -3 lines 0 comments Download

Messages

Total messages: 28
cw
This obsoletes http://codereview.appspot.com/162047/show
15 years, 3 months ago (2009-11-30 10:19:45 UTC) #1
dsymonds
http://codereview.appspot.com/162062/diff/1/2 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/1/2#newcode100 src/pkg/archive/tar/reader.go:100: if err, ok := tr.err.(*os.PathError); ok && err.Error == ...
15 years, 3 months ago (2009-11-30 23:10:39 UTC) #2
rsc
http://codereview.appspot.com/162062/diff/1/2 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/1/2#newcode100 src/pkg/archive/tar/reader.go:100: if err, ok := tr.err.(*os.PathError); ok && err.Error == ...
15 years, 3 months ago (2009-11-30 23:15:56 UTC) #3
cw
Updated comments. Code to follow. http://codereview.appspot.com/162062/diff/1/2 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/1/2#newcode100 src/pkg/archive/tar/reader.go:100: if err, ok := ...
15 years, 3 months ago (2009-12-01 05:52:30 UTC) #4
cw
Hello rsc, dsymonds1 (cc: cw), I'd like you to review the following change.
15 years, 3 months ago (2009-12-01 05:57:56 UTC) #5
dsymonds
LGTM http://codereview.appspot.com/162062/diff/3005/2007 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/3005/2007#newcode104 src/pkg/archive/tar/reader.go:104: tr.nb, tr.pad = 0, 0; delete this line ...
15 years, 3 months ago (2009-12-01 06:03:17 UTC) #6
cw
more comments http://codereview.appspot.com/162062/diff/3005/2007 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/3005/2007#newcode104 src/pkg/archive/tar/reader.go:104: tr.nb, tr.pad = 0, 0; On 2009/12/01 ...
15 years, 3 months ago (2009-12-01 06:05:16 UTC) #7
cw
Hello rsc, dsymonds1, I'd like you to review the following change.
15 years, 3 months ago (2009-12-01 06:09:08 UTC) #8
rsc
> .Next() // get first header > > for { .Read() ; if EOF break ...
15 years, 3 months ago (2009-12-01 08:31:14 UTC) #9
cw
On Tue, Dec 01, 2009 at 12:31:07AM -0800, Russ Cox wrote: > i still don't ...
15 years, 3 months ago (2009-12-01 10:00:29 UTC) #10
cw
What's the status of this?
15 years, 3 months ago (2009-12-02 01:08:30 UTC) #11
rsc
http://codereview.appspot.com/162062/diff/3012/2014 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/3012/2014#newcode204 src/pkg/archive/tar/reader.go:204: // Read(b) reads from the current entry in the ...
15 years, 3 months ago (2009-12-03 21:05:52 UTC) #12
rsc
cw - waiting on a reply On Thu, Dec 3, 2009 at 13:05, <rsc@golang.org> wrote: ...
15 years, 3 months ago (2009-12-04 19:02:20 UTC) #13
cw
[Updated] Hi, I'd like you to review the following change. http://codereview.appspot.com/162062/diff/3012/2014 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/3012/2014#newcode204 ...
15 years, 3 months ago (2009-12-07 10:03:55 UTC) #14
rsc
http://codereview.appspot.com/162062/diff/5001/5002 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/5001/5002#newcode209 src/pkg/archive/tar/reader.go:209: // file entry completely consumed s/entry completely // http://codereview.appspot.com/162062/diff/5001/5004 ...
15 years, 3 months ago (2009-12-07 20:54:48 UTC) #15
cw
Hello rsc, dsymonds1, I'd like you to review the following change. http://codereview.appspot.com/162062/diff/5001/5002 File src/pkg/archive/tar/reader.go (right): ...
15 years, 3 months ago (2009-12-07 23:38:43 UTC) #16
rsc
looks good; two small things http://codereview.appspot.com/162062/diff/5011/6004 File src/pkg/archive/tar/reader.go (right): http://codereview.appspot.com/162062/diff/5011/6004#newcode128 src/pkg/archive/tar/reader.go:128: } } else { ...
15 years, 3 months ago (2009-12-11 20:48:31 UTC) #17
cw
Hello rsc, dsymonds1 (cc: cw), I'd like you to review the following change.
15 years, 3 months ago (2009-12-11 21:49:36 UTC) #18
rsc
tried to apply your change but it doesn't work for me. ; gotest rm -f ...
15 years, 3 months ago (2009-12-11 21:53:24 UTC) #19
cw
> --- FAIL: tar.TestNonSeekable > Didn't process all files > expected: 2 > processed 1 ...
15 years, 3 months ago (2009-12-11 22:55:36 UTC) #20
cw
I can't reproduce this failure. Arch/platform? Dependant? cw@lysdexia:~/wk/go/go.hg/src/pkg/archive/tar$ gotest rm -f _test/archive/tar.a _gotest_.6 6g -o ...
15 years, 3 months ago (2009-12-11 23:02:40 UTC) #21
rsc
Only fails on darwin/386. darwin/amd64 and linux/* seem to work. ; dtruss 8.out --- FAIL: ...
15 years, 3 months ago (2009-12-11 23:07:17 UTC) #22
cw
On Fri, Dec 11, 2009 at 03:07:13PM -0800, Russ Cox wrote: > Only fails on ...
15 years, 3 months ago (2009-12-11 23:33:54 UTC) #23
cw
The problem is darwin 386 syscall interface for seek doesn't return errors. I manually patched ...
15 years, 3 months ago (2009-12-12 06:21:09 UTC) #24
cw
On Sat, Dec 12, 2009 at 06:21:09AM +0000, cw@f00f.org wrote: > I need to find ...
15 years, 3 months ago (2009-12-12 06:34:22 UTC) #25
cw
Hello rsc, dsymonds1, I'd like you to review the following change.
15 years, 3 months ago (2009-12-12 06:49:40 UTC) #26
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=a33ae1785d42 *** archive/tar: bug fixes. 1. If all data is exhausted using ...
15 years, 3 months ago (2009-12-14 20:23:52 UTC) #27
rsc
15 years, 3 months ago (2009-12-14 20:24:17 UTC) #28

          
Sign in to reply to this message.

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