thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

Diffoscope: exclude directory metadata

β€’ 206 words β€’ 1 min

⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.

Previously, previously.

If you simply run diffoscope dir1/ dir2/, a lot of noise could be added to the output due to metadata such as timestamps:

β”‚   --- dir1/foo.yaml
β”‚ β”œβ”€β”€ +++ dir2/foo.yaml
β”‚ β”‚ β”œβ”€β”€ stat {}
β”‚ β”‚ β”‚ @@ -1,8 +1,8 @@
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚    Size: 314              Blocks: 8          IO Block: 4096   regular file
β”‚ β”‚ β”‚  Device: 1,17     Links: 1
β”‚ β”‚ β”‚  Access: (0644/-rw-r--r--)  Uid: (  501/thiago.perrotta)   Gid: (   20/   staff)
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ +Modify: 2025-06-16 09:53:55.107373563 +0000
β”‚ β”‚ β”‚ -Modify: 2025-04-04 14:37:59.032398559 +0000
β”‚ β”‚   --- dir1/bar.yaml
β”‚ β”œβ”€β”€ +++ dir2/bar.yaml
β”‚ β”‚ β”œβ”€β”€ stat {}
β”‚ β”‚ β”‚ @@ -1,8 +1,8 @@
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚    Size: 444              Blocks: 8          IO Block: 4096   regular file
β”‚ β”‚ β”‚  Device: 1,17     Links: 1
β”‚ β”‚ β”‚  Access: (0644/-rw-r--r--)  Uid: (  501/thiago.perrotta)   Gid: (   20/   staff)
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ +Modify: 2025-06-16 09:53:55.107527976 +0000
β”‚ β”‚ β”‚ -Modify: 2025-03-05 13:37:47.461442994 +0000

These timestamps are relevant in the context of reproducible builds, however we don’t particularly care about them when we’re merely interested in diffing directory and file contents.

Thankfully, diffoscope has a flag to ignore these:

shell
diffoscope dir1/ dir2/ --exclude-directory-metadata=yes