User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:220.127.116.11) Gecko/20071224 Firefox/18.104.22.168
While parsing a mbox file, the mailwatcher plugin does not handle From "headers" that are inside the mail content itself. What will happen is that this will be counted as an extra mail, and because there is no following "Status: " header, the plugin thinks this is a new and unread mail. This can be annoying since the "You have new mail" status will be active all the time.
I have managed to fix this problem with a patch that I will attach. The patch will make the plugin look for an additional "Return-Path: " header that has to appear right after the "From " header, or else it will not be counted as a mail. I am not sure however, if this is the best solution to the problem, or works for everyone. I do not know if a "Return-Path: " header should _always_ come after the initial "From " header.
Steps to Reproduce:
1.Receive mail with a string containing "From " inside the content.
2.Open the mailbox and "read" the mail.
3.Observe that mailwatcher still thinks there are "new" mails
Icon shows that new mail has arrived.
Icon should show that no new mail has in fact arrived.
Created attachment 1585
Patch to modify parsing behaviour.
Comment on attachment 1585
Patch to modify parsing behaviour.
No, you can't be sure that *any* particular header will be right after the 'From ' line.
What mail client are you using that's generating/editing these mbox files? The mbox spec says that any line that starts with a 'From ' token needs to be escaped by anyone writing the file. Sounds like your mail program is broken.
I'm using getmail and mutt. I guess that getmail just writes directly to the mbox file without escaping anything, as you say. We can shift the blame, and you may close this issue if you want.
Actually, I just looked at the mbox RFC (http://tools.ietf.org/rfc/rfc4155.txt). It does state that there's really no formal standard, and different implementations work in different ways, but it does point out that many implementations don't escape 'From' lines inside message bodies, and parsers should be able to handle that.
I didn't write the mbox parser, Pasi did, and he's not really around anymore, so I'm not sure if I'll ever get to this, but I guess it would be worthwhile to try to work around it.
Created attachment 3920
mailcheck regex patch
Change the new message logic to more precisely match the "From " line using regular expressions.
So, I meant to add some additional info to my previous comment with the patch, but it seems to have been eaten by bugzilla. Here it is:
I've run into this bug also, and it's quite annoying. I wrote a patch to fix it. Instead of relying on the presense of any particular header after the "From " line, I changed the logic to see if we're in a new message to use a regular expression instead of just a simple strncmp.
I've tested this patch on a few different machines running different client software (Linux, Solaris, mh, mutt, Postfix, Sendmail) and it seems to work with no problems. The regex is designed to match (as closely as possible) the format of the "From " line as defined in RFC 4155. It seems unlikely that you would find this exact string in any normal mail message.
Created attachment 3922
mbox regex patch (refined)
Refine the regex a bit to further avoid false positives.
Mass-reassign all bugs from florian@ to goodies-dev@, thanks for the maintenance work! (and sorry for the bugmail spam..)
-- GitLab Migration Automatic Message --
This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/panel-plugins/xfce4-mailwatch-plugin/-/issues/3.
Please create an account or use an existing account on one of our supported OAuth providers.
If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests
Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev