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.
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 thatsameFile
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.