containerd / continuity

A transport-agnostic, filesystem metadata manifest system
https://containerd.io
Apache License 2.0
141 stars 67 forks source link

Empty files can diff as "modified" even when they're not #152

Closed tomfaulhaber closed 4 years ago

tomfaulhaber commented 4 years ago

This if statement is not always triggered correctly because of a flaw in the logic above it.

https://github.com/containerd/continuity/blob/d3ef23f19fbb106bb73ffde425d07a9187e30745/fs/path.go#L126

If the size of the file was 0, eq will be false. This means that sameFile thinks that two empty files are different even though they are the same.

As a result, when you start a new container and immediately run ctr snapshot diff on it, you get a bunch of spurious "changed" empty files. This can be problematic when you're trying to understand if there are real changes in the running image.

cpuguy83 commented 4 years ago

Fixed in #153 Thanks!