Bug 62430

Summary: mod-mbox-util fails to empty index file if mbox is emptied
Product: Apache httpd-2 Reporter: Sebb <sebb>
Component: mod_mboxAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: All   
OS: All   

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.