Merge pull request #6085 from hashicorp/tar-go

conditionally set tar header on go >= 1.10
This commit is contained in:
Matthew Hooker 2018-03-29 16:16:43 -07:00 committed by GitHub
commit b97a36a5c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View File

@ -0,0 +1,9 @@
// +build !go1.10
package vagrant
import "archive/tar"
func setHeaderFormat(header *tar.Header) {
// no-op
}

View File

@ -0,0 +1,12 @@
// +build go1.10
package vagrant
import "archive/tar"
func setHeaderFormat(header *tar.Header) {
// We have to set the Format explicitly because of a bug in
// libarchive. This affects eg. the tar in macOS listing huge
// files with zero byte length.
header.Format = tar.FormatGNU
}

View File

@ -126,10 +126,8 @@ func DirToBox(dst, dir string, ui packer.Ui, level int) error {
return err
}
// We have to set the Format explicitly because of a bug in
// libarchive. This affects eg. the tar in macOS listing huge
// files with zero byte length.
header.Format = tar.FormatGNU
// workaround for large archive formats on go >=1.10
setHeaderFormat(header)
// We have to set the Name explicitly because it is supposed to
// be a relative path to the root. Otherwise, the tar ends up