From 5ba8c22385ec3db07eeeeafb434dc2dbb46ce297 Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Tue, 5 May 2015 11:06:54 -0400 Subject: [PATCH] ino and dev must both match for a file to be identical. This case is triggered frequently on ZFS. Signed-off-by: Burke Libbey --- archive/changes_linux.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/archive/changes_linux.go b/archive/changes_linux.go index b1d34b3..dee8b7c 100644 --- a/archive/changes_linux.go +++ b/archive/changes_linux.go @@ -100,6 +100,15 @@ func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) { is1Dir := i1 != nil && i1.IsDir() is2Dir := i2 != nil && i2.IsDir() + sameDevice := false + if i1 != nil && i2 != nil { + si1 := i1.Sys().(*syscall.Stat_t) + si2 := i2.Sys().(*syscall.Stat_t) + if si1.Dev == si2.Dev { + sameDevice = true + } + } + // If these files are both non-existent, or leaves (non-dirs), we are done. if !is1Dir && !is2Dir { return nil @@ -144,7 +153,7 @@ func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) { names = append(names, ni1.name) ix1++ case 0: // ni1 == ni2 - if ni1.ino != ni2.ino { + if ni1.ino != ni2.ino || !sameDevice { names = append(names, ni1.name) } ix1++