compacting local inbox which is a symbolic link
Why does Thunderbird only mark messages in a folder as deleted rather than actually deleting them immediately from the folder itself? Deleted messages are only removed from a folder when it's compacted - why is this extra step necessary?
Compacting folders that are Linux symbolic links results in the following unexpected behaviour:
I have a PC running linux and use the folder <thunderbird profile>/Mail/Local\ Folders/Inbox to keep messages that I move from the remote e-mail server to my local machine. Since other linux e-mail clients traditionally look for mail in /var/spool/mail/<username>, I've set up Inbox as a symbolic link to the relevant file in /var/spool/mail. This works fine - I can read messages in the folder and new messages moved to the folder appear immediately. But when I delete a message and compact the folder to remove it from the folder itself, Inbox becomes an actual regular file in <thunderbird profile>/Mail/Local\ Folders with the deleted messages removed, leaving the original file in /var/spool/mail that it was pointing to unchanged. Why does Thunderbird do this?
I suppose I won't have this problem if I create a hard link instead, since Linux hard links are to all intents and purposes regular files. Bu I can't do this on my machine because my /home directory is on a different partition from the root / directory.
Toate răspunsurile (3)
re : Why does Thunderbird only mark messages in a folder as deleted rather than actually deleting them immediately from the folder itself? Deleted messages are only removed from a folder when it's compacted - why is this extra step necessary?
When you delete an email, it appears to be removed from Inbox and goes to 'Deleted' folder. In reality, it is 'marked as deleted' and remains in Inbox but hidden.
This allows the facility to recover an accidentally deleted email by immediately using 'Undo Delete Message' which changes the 'mark' to reveal the email again. Even if the 'Deleted' folder is emptied or some form of corruption has occurred in the Inbox, it is possible to open the mbox file and change the X-Mozilla-Status: number to recover the email.
Compacting locates the points showing 'marked as deleted' emails within the file and removes that section of the file containing that email. This completely removes the email and recovers space reducing the file size. Nothing can be Undone or recovered if nothing exists, hence why using 'Delete' does not by default auto compact immediately.
Thank you - now I understand that requiring folders to be compacted increases the possibility of recovering accidentally deleted messages. But when compacting a folder which is a symbolic link, why does Thunderbird not just follow the link and operate on the contents of the file the link points to? As I said, compacting a symbolic link breaks the link and creates a new copy of the file with the deleted e-mails removed, leaving the original file that was pointed to unchanged.
I don't know for sure if what you are seeing is a bug or just not supported. Perhaps you shouldn't be doing that - using a symbolic link.
FWIW, https://mzl.la/2dIi2G3 are bug reports that mention hard link and symbolic link