diff --git a/pkg/archive/archive_windows.go b/pkg/archive/archive_windows.go index 8ec4d08828..ec3235febb 100644 --- a/pkg/archive/archive_windows.go +++ b/pkg/archive/archive_windows.go @@ -6,7 +6,17 @@ import ( ) func hasHardlinks(fi os.FileInfo) bool { - return fi.Sys().(*syscall.ByHandleFileInformation).NumberOfLinks > 1 + // A hard link is the file-system representation of a file by which more than one path references a single file in the same volume. + switch v := fi.Sys().(type) { + case *syscall.Win32FileAttributeData: + return len(v.FileName) > 1 + case *syscall.ByHandleFileInformation: + return v.NumberOfLinks > 1 + case *syscall.Win32finddata: + return len(v.FileName) > 1 + default: + return false + } } func getInodeFromStat(stat interface{}) (inode uint64, err error) { diff --git a/pkg/buildpack/buildpack_test.go b/pkg/buildpack/buildpack_test.go index ecddf20fd0..01f7f16d99 100644 --- a/pkg/buildpack/buildpack_test.go +++ b/pkg/buildpack/buildpack_test.go @@ -527,7 +527,7 @@ version = "1.2.3" os.RemoveAll(filepath.Join(bpRootFolder, "original-file-2")) }) - it("hardlink is preserved in the output tar file", func() { + it.Focus("hardlink is preserved in the output tar file", func() { bp, err := buildpack.FromBuildpackRootBlob( blob.NewBlob(bpRootFolder), archive.DefaultTarWriterFactory(),