X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3b1598bb557a30f9a896ed36988702c5ae9f2ba9..43748be08c5d67171cb2f5565670dd0eef889b07:/services/keepstore/volume_unix.go?ds=sidebyside diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go index afae2796bc..6c0f5c4e97 100644 --- a/services/keepstore/volume_unix.go +++ b/services/keepstore/volume_unix.go @@ -122,6 +122,13 @@ func (v *UnixVolume) Compare(loc string, expect []byte) error { bufLen := 1 << 20 if int64(bufLen) > stat.Size() { bufLen = int(stat.Size()) + if bufLen < 1 { + // len(buf)==0 would prevent us from handling + // empty files the same way as non-empty + // files, because reading 0 bytes at a time + // never reaches EOF. + bufLen = 1 + } } cmp := expect buf := make([]byte, bufLen)