update atlas-go to fix symlink-related packer push failures

This commit is contained in:
Megan Marsh 2017-08-08 09:40:44 -07:00
parent eec162ee3c
commit 535268cf85
2 changed files with 20 additions and 31 deletions

View File

@ -372,6 +372,8 @@ func copyDirWalkFn(
return filepath.Walk(target, copyDirWalkFn(
tarW, target, subpath, opts, vcsInclude))
}
// return now so that we don't try to copy twice
return nil
}
return copyConcreteEntry(tarW, subpath, path, info)
@ -418,7 +420,7 @@ func copyConcreteEntry(
if _, err = io.Copy(tarW, f); err != nil {
return fmt.Errorf(
"failed copying file to archive: %s", path)
"failed copying file to archive: %s, %s", path, err)
}
return nil
@ -474,35 +476,22 @@ func copyExtras(w *tar.Writer, extra map[string]string) error {
}
func readLinkFull(path string, info os.FileInfo) (string, os.FileInfo, error) {
// Read the symlink continously until we reach a concrete file.
target := path
tries := 0
for info.Mode()&os.ModeSymlink != 0 {
var err error
target, err = os.Readlink(target)
if err != nil {
return "", nil, err
}
if !filepath.IsAbs(target) {
target, err = filepath.Abs(target)
if err != nil {
return "", nil, err
}
}
info, err = os.Lstat(target)
if err != nil {
return "", nil, err
}
tries++
if tries > 100 {
return "", nil, fmt.Errorf(
"Symlink for %s is too deep, over 100 levels deep",
path)
}
target, err := filepath.EvalSymlinks(path)
if err != nil {
return "", nil, err
}
return target, info, nil
target, err = filepath.Abs(target)
if err != nil {
return "", nil, err
}
fi, err := os.Lstat(target)
if err != nil {
return "", nil, err
}
return target, fi, nil
}
// readCloseRemover is an io.ReadCloser implementation that will remove

6
vendor/vendor.json vendored
View File

@ -579,11 +579,11 @@
"revisionTime": "2017-06-23T01:44:30Z"
},
{
"checksumSHA1": "FUiF2WLrih0JdHsUTMMDz3DRokw=",
"checksumSHA1": "izBSRxLAHN+a/XpAku0in05UzlY=",
"comment": "20141209094003-92-g95fa852",
"path": "github.com/hashicorp/atlas-go/archive",
"revision": "1792bd8de119ba49b17fd8d3c3c1f488ec613e62",
"revisionTime": "2016-11-07T20:49:10Z"
"revision": "17522f63497eefcffc90d528ca1eeaded2b529d3",
"revisionTime": "2017-08-08T16:18:53Z"
},
{
"checksumSHA1": "IR7S+SOsSUnPnLxgRrfemXfCqNM=",