pkolaczk / fclones

Efficient Duplicate File Finder
MIT License
1.99k stars 79 forks source link

Fix race condition in test_file_hash causing spurious test failures #180

Closed ivan closed 1 year ago

ivan commented 1 year ago

Use NamedTempFile to avoid using the same, clashing filenames when several hash tests are run concurrently.

This fixes #179.


I ran while true; do nice /run/current-system/sw/bin/cargo test test_file_hash || break; done on NixOS 22.11 to confirm that this actually fixed the problem.

pkolaczk commented 1 year ago

Wow! Thank you! It happened to me yesterday when I ran tests, and I thought to myself "I need to look into it one day, sth is wrong, but let's first finish that other bug fix..." and I come here and a PR ready to merge. Amazing!