"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/archive/tar/reader_test.go" between
moby-20.10.7.tar.gz and moby-20.10.8.tar.gz

About: Moby is a framework to assemble specialized container systems (formerly project name Docker; see here to clarify the relationship between the projects).

reader_test.go  (moby-20.10.7):reader_test.go  (moby-20.10.8)
skipping to change at line 13 skipping to change at line 13
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package tar package tar
import ( import (
"bytes" "bytes"
"crypto/md5" "crypto/md5"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"math" "math"
"os" "os"
"path" "path"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
"testing" "testing"
"time" "time"
) )
skipping to change at line 776 skipping to change at line 775
// that truncated files are still detected even if the underlying io.Reader // that truncated files are still detected even if the underlying io.Reader
// satisfies io.Seeker. // satisfies io.Seeker.
func TestReadTruncation(t *testing.T) { func TestReadTruncation(t *testing.T) {
var ss []string var ss []string
for _, p := range []string{ for _, p := range []string{
"testdata/gnu.tar", "testdata/gnu.tar",
"testdata/ustar-file-reg.tar", "testdata/ustar-file-reg.tar",
"testdata/pax-path-hdr.tar", "testdata/pax-path-hdr.tar",
"testdata/sparse-formats.tar", "testdata/sparse-formats.tar",
} { } {
buf, err := ioutil.ReadFile(p) buf, err := os.ReadFile(p)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
ss = append(ss, string(buf)) ss = append(ss, string(buf))
} }
data1, data2, pax, sparse := ss[0], ss[1], ss[2], ss[3] data1, data2, pax, sparse := ss[0], ss[1], ss[2], ss[3]
data2 += strings.Repeat("\x00", 10*512) data2 += strings.Repeat("\x00", 10*512)
trash := strings.Repeat("garbage ", 64) // Exactly 512 bytes trash := strings.Repeat("garbage ", 64) // Exactly 512 bytes
skipping to change at line 868 skipping to change at line 867
} }
var cnt int var cnt int
var err error var err error
for { for {
if _, err = tr.Next(); err != nil { if _, err = tr.Next(); err != nil {
break break
} }
cnt++ cnt++
if s2 == "manual" { if s2 == "manual" {
if _, err = tr.writeTo(ioutil.Discard); e rr != nil { if _, err = tr.writeTo(io.Discard); err ! = nil {
break break
} }
} }
} }
if err != v.err { if err != v.err {
t.Errorf("test %d, NewReader(%s) with %s discard: got %v, want %v", t.Errorf("test %d, NewReader(%s) with %s discard: got %v, want %v",
i, s1, s2, err, v.err) i, s1, s2, err, v.err)
} }
if cnt != v.cnt { if cnt != v.cnt {
t.Errorf("test %d, NewReader(%s) with %s discard: got %d headers, want %d headers", t.Errorf("test %d, NewReader(%s) with %s discard: got %d headers, want %d headers",
 End of changes. 3 change blocks. 
3 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)