File src/pkg/archive/tar/writer.go (right):
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer.go#newcode202
src/pkg/archive/tar/writer.go:202: fmt.Fprintf(&buf, "%d%s", size, msg)
The pax standard is weird here. It states that the %d must be the length
of the entire message (including) %d. So somehow we have to add that
length on. I'm convinced what I have here is wrong, I'll try and submit
something better. Here is an example of a real live pax header:
"30 mtime=1350244992.023960108\n"
I'm submitting code which I think does the length adjustment correctly.
On 2012/10/31 12:16:25, dsymonds wrote:
I am confused by this construction. Shouldn't it be something more
like this?
msg := fmt.Sprintf(" path=%s\n", hdr.Name)
fmt.Fprintf(&buf, "%d %s", len(msg), msg)
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer.go#newcode212I am confused by this construction. Shouldn't it be something more
like this?
msg := fmt.Sprintf(" path=%s\n", hdr.Name)
fmt.Fprintf(&buf, "%d %s", len(msg), msg)
src/pkg/archive/tar/writer.go:212: err := tw.WriteHeader(extendedHdr)
On 2012/10/31 12:16:25, dsymonds wrote:
snuggle these where possible.
if err := tw.WriteHeader(ext); err != nil {
return err
}
etc.
Done.snuggle these where possible.
if err := tw.WriteHeader(ext); err != nil {
return err
}
etc.
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer_test.go
File src/pkg/archive/tar/writer_test.go (right):
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer_test.go#newcode193
src/pkg/archive/tar/writer_test.go:193: t.Fatal("os.Stat: " +
err.Error())
On 2012/10/31 12:16:25, dsymonds wrote:
t.Fatalf("os.Stat: %v", err)
Done.t.Fatalf("os.Stat: %v", err)
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer_test.go#newcode196
src/pkg/archive/tar/writer_test.go:196: long_name :=
strings.Repeat("ab", 100)
On 2012/10/31 12:16:25, dsymonds wrote:
long_name -> longName
Done.long_name -> longName
https://codereview.appspot.com/6700047/diff/29004/src/pkg/archive/tar/writer_test.go#newcode220
src/pkg/archive/tar/writer_test.go:220: if !(hdr.Name == long_name) {
On 2012/10/31 12:16:25, dsymonds wrote:
if hdr.Name != longName
Done.if hdr.Name != longName
https://codereview.appspot.com/6700047/