Skip to content

testEqualContents: false positive on directory size #393375

@roberth

Description

@roberth

Nixpkgs version

  • Unstable (25.05)

Describe the bug

The usage of diffoscope causes difference in the directory stat "size" to be reported as actual content differences. However, the number stat reports for a directory is arbitrary, file system dependent, and may differ, depending on the history of the directory.
Example:

Steps to reproduce

This may be tricky to reproduce.
I believe ext4 does not scale down the allocated space for a directory, so you could create a directory with many files, remove most of them except one, and compare it to a fresh directory that only ever had that one file.

Expected behaviour

Directory stat details are ignored.

Screenshots

No response

Relevant log output

error: builder for '/nix/store/rmkv6qyj0c0apwizi416rgagn1scd0j2-equal-contents-trivial-patch-does-not-change-source-contents.drv' failed with exit code 1;
       last 25 log lines:
       > │ │   --- /nix/store/m5d4p9qxqz6ldzi001zmdja29r66hyrm-nix-source-patched-source/tests/functional
       > │ ├── +++ /nix/store/1mgs90n2grwxlcn19kxhz5b3fm9gd56h-f3bwis7cbrg5z42wzvfz1h7m3ndabkb9-source/tests/functional
       > │ │ │   --- /nix/store/m5d4p9qxqz6ldzi001zmdja29r66hyrm-nix-source-patched-source/tests/functional/lang
       > │ │ ├── +++ /nix/store/1mgs90n2grwxlcn19kxhz5b3fm9gd56h-f3bwis7cbrg5z42wzvfz1h7m3ndabkb9-source/tests/functional/lang
       > │ │ │ ├── stat {}
       > │ │ │ │ @@ -1,7 +1,7 @@
       > │ │ │ │
       > │ │ │ │ +  Size: 32768      Blocks: 64         IO Block: 4096   directory
       > │ │ │ │ -  Size: 28672            Blocks: 64         IO Block: 4096   directory
       > │ │ │ │  Device: 8,17     Access: (0555/dr-xr-xr-x)  Uid: (65534/  nobody)   Gid: (65534/ nogroup)
       > │ │ │ │
       > │ │ │ │  Modify: 1970-01-01 00:00:01.000000000 +0000
       > │ │ │ ├── stat {}
       > │ │ │ │ @@ -1,7 +1,7 @@
       > │ │ │ │
       > │ │ │ │ -  Size: 28672          Blocks: 64         IO Block: 4096   directory
       > │ │ │ │ +  Size: 32768            Blocks: 64         IO Block: 4096   directory
       > │ │ │ │  Device: 8,17     Access: (0555/dr-xr-xr-x)  Uid: (65534/  nobody)   Gid: (65534/ nogroup)
       > │ │ │ │
       > │ │ │ │  Modify: 1970-01-01 00:00:01.000000000 +0000
       >
       > Contents must be equal, but were not!
       >
       > +: expected,   at /nix/store/1mgs90n2grwxlcn19kxhz5b3fm9gd56h-f3bwis7cbrg5z42wzvfz1h7m3ndabkb9-source
       > -: unexpected, at /nix/store/m5d4p9qxqz6ldzi001zmdja29r66hyrm-nix-source-patched-source

Additional context

https://github.com/NixOS/nix/actions/runs/14081916008/job/39436628264?pr=12759

System metadata

Discovered on GitHub Actions, unknown

Notify maintainers

@tie


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions