zevv / duc

Dude, where are my bytes: Duc, a library and suite of tools for inspecting disk usage
GNU Lesser General Public License v3.0
598 stars 79 forks source link

`test.sh` failing due to an incorrect MD5 checksum. #317

Open fabionatali opened 1 year ago

fabionatali commented 1 year ago

Hi,

Thanks for creating Duc.

I've been trying to run the test.sh test suite that comes with Duc but I seem to be getting the following error:

$ ./test.sh
report: ok
md5sum: failed
expected: 
33e2be27a9e70e81d4006a2d7b555948  /tmp/duc-test.out
got: 
38ab7b7d1ec6ac57d672c5618371386d  /tmp/duc-test.out

This seems to be due to the --check-hard-links option and the way hard links are handled under different operating systems. Launching test.sh across different OSes, I noticed that duc-test.out may report one of the following three snippets, where one, two, and three are hard links that all link to the same file.

  9.8K  ├─ hard-link
  9.8K  │   ╰─ one
  9.8K  ├─ hard-link
  9.8K  │   ╰─ two
  9.8K  ├─ hard-link
  9.8K  │   ╰─ three

In turn, the generated duc-test.out file may have checksum, respectively,

Crucially, only the first checksum is accepted as valid by test.sh, the other two are reported as failures.

My understanding is that these may be all correct outcomes and that we should only be testing for the number of files reported - not for which particular one gets reported? I'm glad to send a tiny patch for this - but would be glad to get my intuition validated first.

Thanks, Fabio.

l8gravely commented 1 year ago

"fabionatali" == fabionatali @.***> writes:

Thanks for creating Duc.

I'm just the helper bee! :-) Ico did all the hard work...

I've been trying to run the test.sh test suite that comes with Duc but I seem to be getting the following error:

$ ./test.sh report: ok md5sum: failed expected: 33e2be27a9e70e81d4006a2d7b555948 /tmp/duc-test.out got: 38ab7b7d1ec6ac57d672c5618371386d /tmp/duc-test.out

Thank you for the report.

This seems to be due to the --check-hard-links option and the way hard links are handled under different operating systems. Launching test.sh across different OSes, I noticed that duc-test.out' may report one of the following three snippets, where one, two, and three` are hard links that all link to the same file.

9.8K ├─ hard-link 9.8K │ ╰─ one

9.8K ├─ hard-link 9.8K │ ╰─ two

9.8K ├─ hard-link 9.8K │ ╰─ three

In turn, the generated duc-test.out' file may have checksum, respectively, 78dbf880ef6917ea665fddb5ebb44428, 38ab7b7d1ec6ac57d672c5618371386d, or 33e2be27a9e70e81d4006a2d7b555948. Crucially, only the first checksum is accepted as valid by test.sh`, the other two are reported as failures.

My understanding is that these may be all correct outcomes and that we should only be testing for the number of files reported - not for which particular one gets reported? I'm glad to send a tiny patch for this - but would be glad to get my intuition validated first.

This makes alot of sense. If you can write up a patch, I'll be happy to look it over and test it out and then integrate it into the tests.

We're very much in a holding pattern here, but glad to know that people are still using and liking the tool.

John

fabionatali commented 1 year ago

Hey @l8gravely, thanks for getting back to me. I had a go at it with #318 - hope it's ok.

fabionatali commented 1 year ago

@l8gravely, sorry, quick follow up and low-priority request. If #318 looks alright and ends up being merged, would you consider creating a new git tag for it? That would make things marginally cleaner when it comes to packaging duc under my OS distribution. Thanks, best, Fabio.