vendor: update containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
full diff: d3ef23f19f...efbc4488d8
Fix sameFile() to recognize empty files as the same
  - fixes "Empty files can diff as "modified" even when they're not"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
			
			
This commit is contained in:
		
							
								
								
									
										8
									
								
								vendor/github.com/containerd/continuity/context.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/containerd/continuity/context.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -596,7 +596,7 @@ func (c *context) Walk(fn filepath.WalkFunc) error { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
| 	return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, err error) error { | ||||
| 	return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, _ error) error { | ||||
| 		contained, err := c.containWithRoot(p, root) | ||||
| 		return fn(contained, fi, err) | ||||
| 	}) | ||||
| @@ -613,12 +613,6 @@ func (c *context) fullpath(p string) (string, error) { | ||||
| 	return p, nil | ||||
| } | ||||
|  | ||||
| // contain cleans and santizes the filesystem path p to be an absolute path, | ||||
| // effectively relative to the context root. | ||||
| func (c *context) contain(p string) (string, error) { | ||||
| 	return c.containWithRoot(p, c.root) | ||||
| } | ||||
|  | ||||
| // containWithRoot cleans and santizes the filesystem path p to be an absolute path, | ||||
| // effectively relative to the passed root. Extra care should be used when calling this | ||||
| // instead of contain. This is needed for Walk, as if context root is a symlink, | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/containerd/continuity/devices/devices_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/containerd/continuity/devices/devices_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -32,6 +32,7 @@ func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) { | ||||
| 		return 0, 0, fmt.Errorf("cannot extract device from os.FileInfo") | ||||
| 	} | ||||
|  | ||||
| 	//nolint:unconvert | ||||
| 	dev := uint64(sys.Rdev) | ||||
| 	return uint64(unix.Major(dev)), uint64(unix.Minor(dev)), nil | ||||
| } | ||||
|   | ||||
							
								
								
									
										10
									
								
								vendor/github.com/containerd/continuity/digests.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/containerd/continuity/digests.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -88,13 +88,9 @@ func digestsMatch(as, bs []digest.Digest) bool { | ||||
| 	} | ||||
|  | ||||
| 	disjoint := len(as) + len(bs) | ||||
| 	if len(uniqified) == disjoint { | ||||
| 		// if these two sets have the same cardinality, we know both sides | ||||
| 		// didn't share any digests. | ||||
| 		return false | ||||
| 	} | ||||
|  | ||||
| 	return true | ||||
| 	// if these two sets have the same cardinality, we know both sides | ||||
| 	// didn't share any digests. | ||||
| 	return len(uniqified) != disjoint | ||||
| } | ||||
|  | ||||
| type digestSlice []digest.Digest | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/containerd/continuity/driver/driver_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/containerd/continuity/driver/driver_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +1,5 @@ | ||||
| // +build go1.13 | ||||
|  | ||||
| /* | ||||
|    Copyright The containerd Authors. | ||||
|  | ||||
| @@ -14,8 +16,6 @@ | ||||
|    limitations under the License. | ||||
| */ | ||||
|  | ||||
| // +build go1.13 | ||||
|  | ||||
| // Go 1.13 is the minimally supported version for Windows. | ||||
| // Earlier golang releases have bug in os.Readlink | ||||
| // (see https://github.com/golang/go/issues/30463). | ||||
|   | ||||
							
								
								
									
										4
									
								
								vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/containerd/continuity/fs/fstest/continuity_util.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -47,7 +47,7 @@ func (l resourceListDifference) HasDiff() bool { | ||||
| 	} | ||||
|  | ||||
| 	for _, add := range l.Additions { | ||||
| 		if ok, _ := metadataFiles[add.Path()]; !ok { | ||||
| 		if ok := metadataFiles[add.Path()]; !ok { | ||||
| 			return true | ||||
| 		} | ||||
| 	} | ||||
| @@ -66,7 +66,7 @@ func (l resourceListDifference) String() string { | ||||
| 	for _, upt := range l.Updates { | ||||
| 		fmt.Fprintf(buf, "~ %s\n", upt.String()) | ||||
| 	} | ||||
| 	return string(buf.Bytes()) | ||||
| 	return buf.String() | ||||
| } | ||||
|  | ||||
| // diffManifest compares two resource lists and returns the list | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/containerd/continuity/fs/fstest/testsuite.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/containerd/continuity/fs/fstest/testsuite.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -210,7 +210,7 @@ var ( | ||||
| 	} | ||||
|  | ||||
| 	// Hardlink name before with modification | ||||
| 	// Tests link is created for unmodified files when new hardlinked file is seen first | ||||
| 	// Tests link is created for unmodified files when a new hard linked file is seen first | ||||
| 	hardlinkBeforeUnmodified = []Applier{ | ||||
| 		baseApplier, | ||||
| 		Apply( | ||||
|   | ||||
							
								
								
									
										10
									
								
								vendor/github.com/containerd/continuity/fs/path.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/containerd/continuity/fs/path.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -117,15 +117,13 @@ func sameFile(f1, f2 *currentPath) (bool, error) { | ||||
| 		// If the timestamp may have been truncated in both of the | ||||
| 		// files, check content of file to determine difference | ||||
| 		if t1.Nanosecond() == 0 && t2.Nanosecond() == 0 { | ||||
| 			var eq bool | ||||
| 			if (f1.f.Mode() & os.ModeSymlink) == os.ModeSymlink { | ||||
| 				eq, err = compareSymlinkTarget(f1.fullPath, f2.fullPath) | ||||
| 			} else if f1.f.Size() > 0 { | ||||
| 				eq, err = compareFileContent(f1.fullPath, f2.fullPath) | ||||
| 				return compareSymlinkTarget(f1.fullPath, f2.fullPath) | ||||
| 			} | ||||
| 			if err != nil || !eq { | ||||
| 				return eq, err | ||||
| 			if f1.f.Size() == 0 { // if file sizes are zero length, the files are the same by definition | ||||
| 				return true, nil | ||||
| 			} | ||||
| 			return compareFileContent(f1.fullPath, f2.fullPath) | ||||
| 		} else if t1.Nanosecond() != t2.Nanosecond() { | ||||
| 			return false, nil | ||||
| 		} | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/containerd/continuity/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/containerd/continuity/go.mod
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| module github.com/containerd/continuity | ||||
|  | ||||
| go 1.11 | ||||
| go 1.13 | ||||
|  | ||||
| require ( | ||||
| 	bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898 | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/containerd/continuity/groups_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/containerd/continuity/groups_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -14,6 +14,7 @@ | ||||
|    limitations under the License. | ||||
| */ | ||||
|  | ||||
| //nolint:unused,deadcode | ||||
| package continuity | ||||
|  | ||||
| import ( | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/containerd/continuity/hardlinks.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/containerd/continuity/hardlinks.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -53,7 +53,7 @@ func (hlm *hardlinkManager) Add(fi os.FileInfo, resource Resource) error { | ||||
| } | ||||
|  | ||||
| // Merge processes the current state of the hardlink manager and merges any | ||||
| // shared nodes into hardlinked resources. | ||||
| // shared nodes into hard linked resources. | ||||
| func (hlm *hardlinkManager) Merge() ([]Resource, error) { | ||||
| 	var resources []Resource | ||||
| 	for key, linked := range hlm.hardlinks { | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/github.com/containerd/continuity/hardlinks_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/containerd/continuity/hardlinks_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -48,5 +48,6 @@ func newHardlinkKey(fi os.FileInfo) (hardlinkKey, error) { | ||||
| 		return hardlinkKey{}, errNotAHardLink | ||||
| 	} | ||||
|  | ||||
| 	//nolint:unconvert | ||||
| 	return hardlinkKey{dev: uint64(sys.Dev), inode: uint64(sys.Ino)}, nil | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/github.com/containerd/continuity/manifest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/containerd/continuity/manifest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -114,11 +114,13 @@ func BuildManifest(ctx Context) (*Manifest, error) { | ||||
| 	} | ||||
|  | ||||
| 	// merge and post-process the hardlinks. | ||||
| 	// nolint:misspell | ||||
| 	hardlinked, err := hardlinks.Merge() | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	// nolint:misspell | ||||
| 	for _, resource := range hardlinked { | ||||
| 		resourcesByPath[resource.Path()] = resource | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										12
									
								
								vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/containerd/continuity/sysx/xattr_unsupported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -23,7 +23,7 @@ import ( | ||||
| 	"runtime" | ||||
| ) | ||||
|  | ||||
| var unsupported = errors.New("extended attributes unsupported on " + runtime.GOOS) | ||||
| var errUnsupported = errors.New("extended attributes unsupported on " + runtime.GOOS) | ||||
|  | ||||
| // Listxattr calls syscall listxattr and reads all content | ||||
| // and returns a string array | ||||
| @@ -33,17 +33,17 @@ func Listxattr(path string) ([]string, error) { | ||||
|  | ||||
| // Removexattr calls syscall removexattr | ||||
| func Removexattr(path string, attr string) (err error) { | ||||
| 	return unsupported | ||||
| 	return errUnsupported | ||||
| } | ||||
|  | ||||
| // Setxattr calls syscall setxattr | ||||
| func Setxattr(path string, attr string, data []byte, flags int) (err error) { | ||||
| 	return unsupported | ||||
| 	return errUnsupported | ||||
| } | ||||
|  | ||||
| // Getxattr calls syscall getxattr | ||||
| func Getxattr(path, attr string) ([]byte, error) { | ||||
| 	return []byte{}, unsupported | ||||
| 	return []byte{}, errUnsupported | ||||
| } | ||||
|  | ||||
| // LListxattr lists xattrs, not following symlinks | ||||
| @@ -53,12 +53,12 @@ func LListxattr(path string) ([]string, error) { | ||||
|  | ||||
| // LRemovexattr removes an xattr, not following symlinks | ||||
| func LRemovexattr(path string, attr string) (err error) { | ||||
| 	return unsupported | ||||
| 	return errUnsupported | ||||
| } | ||||
|  | ||||
| // LSetxattr sets an xattr, not following symlinks | ||||
| func LSetxattr(path string, attr string, data []byte, flags int) (err error) { | ||||
| 	return unsupported | ||||
| 	return errUnsupported | ||||
| } | ||||
|  | ||||
| // LGetxattr gets an xattr, not following symlinks | ||||
|   | ||||
							
								
								
									
										8
									
								
								vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -22,8 +22,8 @@ import ( | ||||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"syscall" | ||||
| 	"strings" | ||||
| 	"syscall" | ||||
|  | ||||
| 	"github.com/pkg/errors" | ||||
| 	"github.com/sirupsen/logrus" | ||||
| @@ -70,9 +70,9 @@ func New(size int64) (*Loopback, error) { | ||||
| 	} | ||||
|  | ||||
| 	l := Loopback{ | ||||
| 		File: file.Name(), | ||||
| 		File:   file.Name(), | ||||
| 		Device: deviceName, | ||||
| 		close: cleanup, | ||||
| 		close:  cleanup, | ||||
| 	} | ||||
| 	return &l, nil | ||||
| } | ||||
| @@ -83,7 +83,7 @@ type Loopback struct { | ||||
| 	File string | ||||
| 	// Device is /dev/loopX | ||||
| 	Device string | ||||
| 	close func() error | ||||
| 	close  func() error | ||||
| } | ||||
|  | ||||
| // SoftSize returns st_size | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn