pkolaczk / fclones

Efficient Duplicate File Finder
MIT License
1.91k stars 71 forks source link

test_partition_respects_isolated_roots depends on filesystem ctime #104

Closed cyounkins closed 2 years ago

cyounkins commented 2 years ago

Automated tests in Nix fail because ctime is not available in the test environment.

---- dedupe::test::test_partition_respects_isolated_roots stdout ----
[2022-03-18 13:13:59.583] fclones-e004d9d9a96035e2:  warn: Failed to read creation time of file /build/source/target/test/dedupe/partition/isolated_roots/root2/file_1: creation time is not available for the filesystem
[2022-03-18 13:13:59.583] fclones-e004d9d9a96035e2:  warn: Failed to read creation time of file /build/source/target/test/dedupe/partition/isolated_roots/root1/file_1: creation time is not available for the filesystem
thread 'dedupe::test::test_partition_respects_isolated_roots' panicked at 'called `Result::unwrap()` on an `Err` value: Error { message: "Could not determine files to drop in group with hash 00000000000000000000000000000000 and len 0: Metadata of some files could not be read." }', src/dedupe.rs:1225:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The test: https://github.com/pkolaczk/fclones/blob/9f0a8cb5514e44e6844828a27cf7b155c9761ac0/src/dedupe.rs#L1206

This issue was previously worked around with a condition in the test: https://github.com/pkolaczk/fclones/blob/9f0a8cb5514e44e6844828a27cf7b155c9761ac0/src/dedupe.rs#L1116

            if fs::metadata(root).unwrap().created().is_err() {
                // can't run the test because the filesystem doesn't support fetching
                // file creation time
                return;
            }

Fixed in commit: https://github.com/pkolaczk/fclones/commit/9503ad18e81feca5f9b546151298f1829ec1144b

Reference to Nix build issue for 0.18: https://github.com/NixOS/nixpkgs/pull/164708

Can we fix this issue with the same guard? Would you like a PR? Thanks!