Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 96575
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: ken [...] kneighbors.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 3.36



Subject: Parsing Fixes for fetch_hash
Date: Thu, 19 Jun 2014 18:09:37 -0700
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Ken Neighbors <ken [...] kneighbors.com>
In the process of gathering message information from my gmail account using the fetch_hash method of Mail::IMAPClient, I ran into a couple problems with backslashes and unclosed parentheses in the subject line. Specifically, one of my emails had this "To:" field: To: "\\"Ken Neighbors\\"" <ken@example.org> Yes, that has two backslashes before a quote, which showed up in Gmail IMAP FETCH results as simply "\\" (that is, a quote, two backslashes, and another quote). This caused a problem in fetch_hash because it thought the ending-quote was escaped. Another of my emails had this Subject field showing up in the ENVELOPE FETCH result: "Re: Item #270517148775 Instant payment received kenneighbors (ken@example. .." That is, it had an opening parenthesis but no closing parentheses. Again, it caused a problem in fetch_hash. Background Info: Mail-IMAPClient-3.35 perl v5.10.1 3.2.0-0.bpo.4-amd64 #1 SMP Debian 3.2.57-3+deb7u2~bpo60+1 x86_64 GNU/Linux I patched IMAPClient.pm and Parse.grammar to fix these problems and have attached the patch and several test cases. To summarize the changes: 1. In IMAPClient.pm I updated two regular expressions to recognize an escaped backslash appearing before an ending quote using the advice from http://blog.stevenlevithan.com/archives/match-quoted-string 2. In Parse.grammar I allowed an escaped backslash in DOUBLE_QUOTED_STRING (and SINGLE_QUOTED_STRING, though I'm not sure it is used). Ken Neighbors

Message body is not shown because sender requested not to inline it.

Thanks for the report. I'll look at testing this and working this in on the next release!
I have finally incorporated your changes in this checkin: https://github.com/plobbes/mail-imapclient/commit/2bdd2e01e841f30bdb4d978ff69e17703da7258a This will be included in the next release (soon). Thank you for taking the time to research the problem and especially for proposing a fix which included test cases!
On Thu Aug 13 21:37:40 2015, PLOBBES wrote: Show quoted text
> I have finally incorporated your changes in this checkin: > https://github.com/plobbes/mail- > imapclient/commit/2bdd2e01e841f30bdb4d978ff69e17703da7258a > > This will be included in the next release (soon). Thank you for > taking the time to research the problem and especially for proposing a > fix which included test cases!
There was a side-effect of this fix. The regex was not backwards compatible with Perl 5.8. I redid the regex to be backwards compatible and still pass all the test cases. That will be in release 3.37. https://github.com/plobbes/mail-imapclient/commit/cf8ba920e2dd86927c7262bd83ca929247501a91