kdeldycke/mail-deduplicate

please consider to test syntactical correctness before computation of hashes

leggewie opened this issue · 2 comments

Computing the hashes is computationally expensive and potentially time-consuming. I think it might be a good idea to test syntactical correctness before that task instead of after. In my case, mdedup had been running 20 to 30 minutes, hashing 20.000 to 30.000 mails before failing.

$ mdedup deduplicate -n -s delete-matching-path -rDAMAGED2020 ~/Maildir/.DAMAGED20200924.Trash/ ~/Maildir/.Trash/
[...]
=== Phase #2: deduplicate mails.
The delete-matching-path strategy will be applied on each duplicate set.
--- 2 mails sharing hash bb2bc9037f04dbdc50519fc7ce88e7694fcb2ececbf49a3fb9d37f5b
Check that mail differences are within the limits.
Traceback (most recent call last):
  File "/home/leggewie/.local/bin/mdedup", line 11, in <module>
    sys.exit(cli())
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/leggewie/.local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/leggewie/.local/lib/python3.6/site-packages/mail_deduplicate/cli.py", line 217, in deduplicate
    dedup.run()
  File "/home/leggewie/.local/lib/python3.6/site-packages/mail_deduplicate/deduplicate.py", line 593, in run
    duplicates.apply_strategy(self.conf.strategy)
TypeError: apply_strategy() takes 1 positional argument but 2 were given

The error you encountered is a side-effect of hurried up release of the v3.0.0, as explained at #90 (comment) . With the upcoming v4.0.0 we'll have a better test suite and pro-active ways to catch up these kind of blatant code errors.

This issue duplicates #88.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.