forked from mirrors/tar-split
Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Vincent Batts | b9127a1393 | |
Vincent Batts | c6dd42815a | |
Vincent Batts | 245403c324 | |
Vincent Batts | 7560005f21 | |
Vincent Batts | bd4c5d64c3 | |
Vincent Batts | d3f1b54304 | |
Vincent Batts | f28028292a | |
Vincent Batts | 416fa5dcfe | |
Derek McGowan | 6b59e6942e | |
Vincent Batts | 7410961e75 |
|
@ -1,8 +1,11 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- tip
|
- tip
|
||||||
- 1.6.2
|
- 1.x
|
||||||
- 1.5.4
|
- 1.8.x
|
||||||
|
- 1.7.x
|
||||||
|
- 1.6.x
|
||||||
|
- 1.5.x
|
||||||
|
|
||||||
# let us have pretty, fast Docker-based Travis workers!
|
# let us have pretty, fast Docker-based Travis workers!
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# tar-split
|
# tar-split
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/vbatts/tar-split.svg?branch=master)](https://travis-ci.org/vbatts/tar-split)
|
[![Build Status](https://travis-ci.org/vbatts/tar-split.svg?branch=master)](https://travis-ci.org/vbatts/tar-split)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/vbatts/tar-split)](https://goreportcard.com/report/github.com/vbatts/tar-split)
|
||||||
|
|
||||||
Pristinely disassembling a tar archive, and stashing needed raw bytes and offsets to reassemble a validating original archive.
|
Pristinely disassembling a tar archive, and stashing needed raw bytes and offsets to reassemble a validating original archive.
|
||||||
|
|
||||||
|
|
|
@ -608,12 +608,12 @@ func (tr *Reader) readHeader() *Header {
|
||||||
header := tr.hdrBuff[:]
|
header := tr.hdrBuff[:]
|
||||||
copy(header, zeroBlock)
|
copy(header, zeroBlock)
|
||||||
|
|
||||||
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
if n, err := io.ReadFull(tr.r, header); err != nil {
|
||||||
|
tr.err = err
|
||||||
// because it could read some of the block, but reach EOF first
|
// because it could read some of the block, but reach EOF first
|
||||||
if tr.err == io.EOF && tr.RawAccounting {
|
if tr.err == io.EOF && tr.RawAccounting {
|
||||||
if _, err := tr.rawBytes.Write(header); err != nil {
|
if _, err := tr.rawBytes.Write(header[:n]); err != nil {
|
||||||
tr.err = err
|
tr.err = err
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil // io.EOF is okay here
|
return nil // io.EOF is okay here
|
||||||
|
@ -626,11 +626,12 @@ func (tr *Reader) readHeader() *Header {
|
||||||
|
|
||||||
// Two blocks of zero bytes marks the end of the archive.
|
// Two blocks of zero bytes marks the end of the archive.
|
||||||
if bytes.Equal(header, zeroBlock[0:blockSize]) {
|
if bytes.Equal(header, zeroBlock[0:blockSize]) {
|
||||||
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
if n, err := io.ReadFull(tr.r, header); err != nil {
|
||||||
|
tr.err = err
|
||||||
// because it could read some of the block, but reach EOF first
|
// because it could read some of the block, but reach EOF first
|
||||||
if tr.err == io.EOF && tr.RawAccounting {
|
if tr.err == io.EOF && tr.RawAccounting {
|
||||||
if _, tr.err = tr.rawBytes.Write(header); tr.err != nil {
|
if _, err := tr.rawBytes.Write(header[:n]); err != nil {
|
||||||
return nil
|
tr.err = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil // io.EOF is okay here
|
return nil // io.EOF is okay here
|
||||||
|
|
|
@ -94,13 +94,12 @@ func TestRoundTrip(t *testing.T) {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
tw := NewWriter(&b)
|
tw := NewWriter(&b)
|
||||||
hdr := &Header{
|
hdr := &Header{
|
||||||
Name: "file.txt",
|
Name: "file.txt",
|
||||||
Uid: 1 << 21, // too big for 8 octal digits
|
Uid: 1 << 21, // too big for 8 octal digits
|
||||||
Size: int64(len(data)),
|
Size: int64(len(data)),
|
||||||
ModTime: time.Now(),
|
// https://github.com/golang/go/commit/0e3355903d2ebcf5ee9e76096f51ac9a116a9dbb#diff-d7bf2a98d7b57b6ff754ca406f1b7581R105
|
||||||
|
ModTime: time.Now().AddDate(0, 0, 0).Round(1 * time.Second),
|
||||||
}
|
}
|
||||||
// tar only supports second precision.
|
|
||||||
hdr.ModTime = hdr.ModTime.Add(-time.Duration(hdr.ModTime.Nanosecond()) * time.Nanosecond)
|
|
||||||
if err := tw.WriteHeader(hdr); err != nil {
|
if err := tw.WriteHeader(hdr); err != nil {
|
||||||
t.Fatalf("tw.WriteHeader: %v", err)
|
t.Fatalf("tw.WriteHeader: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/urfave/cli"
|
||||||
"github.com/vbatts/tar-split/tar/asm"
|
"github.com/vbatts/tar-split/tar/asm"
|
||||||
"github.com/vbatts/tar-split/tar/storage"
|
"github.com/vbatts/tar-split/tar/storage"
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/urfave/cli"
|
||||||
"github.com/vbatts/tar-split/tar/asm"
|
"github.com/vbatts/tar-split/tar/asm"
|
||||||
"github.com/vbatts/tar-split/tar/storage"
|
"github.com/vbatts/tar-split/tar/storage"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/urfave/cli"
|
||||||
"github.com/vbatts/tar-split/tar/asm"
|
"github.com/vbatts/tar-split/tar/asm"
|
||||||
"github.com/vbatts/tar-split/tar/storage"
|
"github.com/vbatts/tar-split/tar/storage"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/codegangsta/cli"
|
"github.com/urfave/cli"
|
||||||
"github.com/vbatts/tar-split/version"
|
"github.com/vbatts/tar-split/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,8 @@ var testCases = []struct {
|
||||||
{"./testdata/longlink.tar.gz", "d9f6babe107b7247953dff6b5b5ae31a3a880add", 20480},
|
{"./testdata/longlink.tar.gz", "d9f6babe107b7247953dff6b5b5ae31a3a880add", 20480},
|
||||||
{"./testdata/fatlonglink.tar.gz", "8537f03f89aeef537382f8b0bb065d93e03b0be8", 26234880},
|
{"./testdata/fatlonglink.tar.gz", "8537f03f89aeef537382f8b0bb065d93e03b0be8", 26234880},
|
||||||
{"./testdata/iso-8859.tar.gz", "ddafa51cb03c74ec117ab366ee2240d13bba1ec3", 10240},
|
{"./testdata/iso-8859.tar.gz", "ddafa51cb03c74ec117ab366ee2240d13bba1ec3", 10240},
|
||||||
|
{"./testdata/extranils.tar.gz", "e187b4b3e739deaccc257342f4940f34403dc588", 10648},
|
||||||
|
{"./testdata/notenoughnils.tar.gz", "72f93f41efd95290baa5c174c234f5d4c22ce601", 512},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTarStream(t *testing.T) {
|
func TestTarStream(t *testing.T) {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
package version
|
package version
|
||||||
|
|
||||||
// AUTO-GENEREATED. DO NOT EDIT
|
// AUTO-GENEREATED. DO NOT EDIT
|
||||||
// 2016-09-23 11:00:18.92191222 -0400 EDT
|
// 2016-09-26 19:53:30.825879 -0400 EDT
|
||||||
|
|
||||||
// VERSION is the generated version from /home/vbatts/src/vb/tar-split/version
|
// VERSION is the generated version from /home/vbatts/src/vb/tar-split/version
|
||||||
var VERSION = "v0.10.0-9-gae8540d"
|
var VERSION = "v0.10.1-4-gf280282"
|
||||||
|
|
Loading…
Reference in New Issue