Bug 62430 - mod-mbox-util fails to empty index file if mbox is emptied
Summary: mod-mbox-util fails to empty index file if mbox is emptied
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_mbox (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2018-06-05 17:09 UTC by Sebb
Modified: 2018-06-08 10:03 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Sebb 2018-06-05 17:09:37 UTC
If a non-empty mbox file is indexed, and then updated to be empty, subsequent update and create runs don't empty the index.

It looks like the code caches the contents of the index file and does not notice that there are now no messages.

It seems the only way to ensure the index is properly recreated is to delete it before running mod-mbox-util
Comment 1 Sebb 2018-06-05 17:32:06 UTC
The same issue occurs if the mbox is editted to remove a message; mmu does not drop the removed message.
Comment 2 Sebb 2018-06-08 10:03:30 UTC
The problem seems to be worse than I thought: messages processed from the mbox file are added to the index. This only works properly if the messages are only ever added to the mbox. Whilst this is the most common scenario, it is not the only possible one.

I would expect the index to be created from the current mbox contents only; any existing entries should be dropped.

The -c option help says:

'-c    Force creation of a new cache. If there is an existing cache, it
       will be ignored and overwritten'

That is not happening; the existing cache is not overwritten.

In the case of the '-u' option, the help text is less clear:

'-u    Updates an existing cache'

However surely the cache should agree with the mbox file from which it was most recently derived - not a combination of all mbox files that have been processed so far.