Restic diff command ignores differences in file timestamps

Comparing two snapshots whose files only differ by their (modification) timestamps shows no differences:

restic init -r repo
touch thing.txt && restic -r repo backup thing.txt
touch thing.txt && restic -r repo backup thing.txt
restic -r repo diff 9c2a58ee 0a5ddce8

The final cmd gives:

repository 358a1f67 opened successfully, password is correct
comparing snapshot 9c2a58ee to 0a5ddce8:


Files:           0 new,     0 removed,     0 changed
Dirs:            0 new,     0 removed
Others:          0 new,     0 removed
Data Blobs:      0 new,     0 removed
Tree Blobs:      0 new,     0 removed
  Added:   0 B  
  Removed: 0 B  

I am wondering whether this could be considered a bug? I was recently comparing backups from before/after a significant system change and thought all was well but in fact some files had their timestamps altered by mistake.

Thanks

Welcome to the forum!

Can you please elaborate on what you think is a bug and what you expect to see instead of what you are seeing? You’re expecting the file to be listed as changed due to the change in metadata?

By default, the diff command does not print files for which just metadata has changed. You can enable this with the --metadata flag. For me, the output of restic diff then looks like this:

$ restic diff -r repo --metadata b5572e20 5f235627
comparing snapshot b5572e20 to 5f235627:

U    /thing.txt

Files:           0 new,     0 removed,     0 changed
Dirs:            0 new,     0 removed
Others:          0 new,     0 removed
Data Blobs:      0 new,     0 removed
Tree Blobs:      0 new,     0 removed
  Added:   0 B  
  Removed: 0 B  

The stats at the bottom count the tree blobs wrong for metadata-only changes in the top-level directory of the snapshot (it works for metadata changes in a subdir), that’s a bug you’ve just discovered. But restic indeed saw the changed modification time. :slight_smile:

Thanks, appreciate the fast response! I should have read the manual :man_facepalming: - would you like me to raise the bug for the smaller top-level issue in the repo?

1 Like

Please do, I haven’t seen @fd0 create anything like that yet, so go ahead so we can track it.

No prob: #3092. Thanks again for the help :slight_smile:

1 Like