After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 347520 - Names containing a dot in address parsed incorrectly
Names containing a dot in address parsed incorrectly
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
2.26.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 343344 503362 547969 550787 553004 558477 559087 617609 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-07-14 14:26 UTC by Matthew Paul Thomas (mpt)
Modified: 2011-10-13 08:17 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
patch to generate silly standalone test app from camel-mime-utils.c (1.05 KB, patch)
2009-02-02 23:38 UTC, Paul Bolle
rejected Details | Review
solution? (580 bytes, patch)
2009-02-02 23:46 UTC, Paul Bolle
reviewed Details | Review
eds patch (5.05 KB, patch)
2010-10-08 07:24 UTC, Milan Crha
committed Details | Review

Description Matthew Paul Thomas (mpt) 2006-07-14 14:26:41 UTC
Evolution 2.6.1, Ubuntu 6.06

I frequently receive messages with this header:
    From: Canonical.com Patch Queue Manager<pqm@pqm.ubuntu.com>
Evolution displays this incorrectly as
    From: 	Canonical.comP <atch Queue Managerpqm@pqm.ubuntu.com>
and the error is repeated in the composition window if I click Reply.

This is similar to bug 343344.
Comment 1 André Klapper 2007-03-01 02:06:14 UTC
rfc2822 requires a folding whitespace (FWS).
closing as notabug.
Comment 2 Matthew Paul Thomas (mpt) 2007-09-08 12:18:49 UTC
That's true, but RFC 793 advises (and market forces require) that Internet software should be liberal in what it accepts from others. Of all the things "Canonical.com Patch Queue Manager<pqm@pqm.ubuntu.com>" could possibly mean, "Canonical.comP <atch Queue Managerpqm@pqm.ubuntu.com>" is not one of them. :-)
Comment 3 Jeffrey Stedfast 2007-09-10 14:10:57 UTC
yea, this is just a bug. probably trivial to fix
Comment 4 Paul Bolle 2008-08-28 00:52:46 UTC
Still reproducible in 2.22.3.
Comment 5 Jeffrey Stedfast 2008-09-01 13:58:29 UTC
ok, so part of the problem is the Canonical.com - in fact, that might be sole cause of the problem.

The '.' causes confusion, but Camel's address parser is also quite clearly broken when it stumbles on that - it doesn't make sense that the P from "Patch" is split off and appended to Canonical.com as if it was part of the "com" word token.
Comment 6 Jeffrey Stedfast 2008-09-01 14:00:25 UTC
as a workaround, you could probably get the sender to quote the name string.
Comment 7 Paul Bolle 2008-09-01 14:31:06 UTC
(In reply to comment #5)
> [..] it doesn't make sense that the P from "Patch"
> is split off and appended to Canonical.com as if it was part of the "com" word
> token.

And also puzzling is the less symbol that got moved to a strange location. It might be what the parser thinks to be the location after the first (and only) non e-mail address token. (Using the parsing terminology loosely here.)
Comment 8 Paul Bolle 2008-09-09 08:40:12 UTC
Altered the summary to make it reflect comment #5 and to make it slightly more general.
Comment 9 Jeffrey Stedfast 2008-09-20 15:08:56 UTC
*** Bug 553004 has been marked as a duplicate of this bug. ***
Comment 10 Jeffrey Stedfast 2008-09-20 15:09:37 UTC
*** Bug 547969 has been marked as a duplicate of this bug. ***
Comment 11 Paul Bolle 2009-02-02 23:38:53 UTC
Created attachment 127800 [details] [review]
patch to generate silly standalone test app from camel-mime-utils.c

This patch generates a silly standalone test app I used to search for a solution. Compile with:
     gcc `pkg-config --cflags --libs glib-2.0 camel-1.2` 347520.c -o 347520

Example output:
./347520 "Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>"

** (process:26838): WARNING **: We didn't get an '@' where we expected in 'Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>', trying again

** (process:26838): WARNING **: Name is '<UNSET>', Addr is 'Canonical.com' we're at 'Patch Queue Manager <pqm@pqm.ubuntu.com>'


** (process:26838): WARNING **: We didn't get an '@' where we expected in 'Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>', trying again

** (process:26838): WARNING **: Name is 'Canonical.comP', Addr is 'atch' we're at ' Queue Manager <pqm@pqm.ubuntu.com>'


** (process:26838): WARNING **: We didn't get an '@' where we expected in 'Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>', trying again

** (process:26838): WARNING **: Name is 'Canonical.comP', Addr is 'atch Queue' we're at ' Manager <pqm@pqm.ubuntu.com>'


** (process:26838): WARNING **: We didn't get an '@' where we expected in 'Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>', trying again

** (process:26838): WARNING **: Name is 'Canonical.comP', Addr is 'atch Queue Manager' we're at ' <pqm@pqm.ubuntu.com>'


** (process:26838): WARNING **: No local-part for email address: Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>

** (process:26838): WARNING **: We didn't get an '@' where we expected in 'Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>', trying again

** (process:26838): WARNING **: Name is 'Canonical.comP', Addr is 'atch Queue Manager ' we're at '<pqm@pqm.ubuntu.com>'

name: Canonical.comP
addr: atch Queue Manager pqm@pqm.ubuntu.com

Note that this doesn't hit the "Working around stupid mailer bug #5: unescaped characters in names" warning.
Comment 12 Paul Bolle 2009-02-02 23:46:43 UTC
Created attachment 127802 [details] [review]
solution?

This could be a solution to this bug.

Example output:
./347520 "Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>"

** (process:26941): WARNING **: Working around stupid mailer bug #5: unescaped characters in names
name: Canonical.com Patch Queue Manager
addr: pqm@pqm.ubuntu.com

I cannot say that I really understand the decoder (parser, whatever) that I am patching here. (The code is, well, not so easily grasped.)

Can anybody think of a regression that would be caused by this patch?
Comment 13 Milan Crha 2009-02-16 18:21:46 UTC
I see one little strangness, when you've a mail address like:
Mr. John D. Oe <john@nowhere.zz>
then the parser removes spaces after those dots. When you've this quoted it is shown as expected (which doesn't surprise).

Would you mind to extend your fix even for this?
Comment 14 Paul Bolle 2009-02-16 19:05:49 UTC
(In reply to comment #13)
> I see one little strangeness, when you've a mail address like:
> Mr. John D. Oe <john@nowhere.zz>
> then the parser removes spaces after those dots.

Good catch.
 
> Would you mind to extend your fix even for this?

No, I wouldn't mind. We have to be careful here, since this will be a workaround for a workaround, won't it? We have to draw the line somewhere...

For example, the related bug #547969 - see comment #10 - might be a nice example of something we shouldn't try to fix. Superfluous dots in the address proper feel like something too broken to bother, doesn't it?
Comment 15 Milan Crha 2009-04-20 13:46:37 UTC
Paul, how is it going?
Comment 16 Milan Crha 2009-04-20 13:46:55 UTC
*** Bug 558477 has been marked as a duplicate of this bug. ***
Comment 17 Milan Crha 2009-04-20 13:47:15 UTC
*** Bug 503362 has been marked as a duplicate of this bug. ***
Comment 18 Paul Bolle 2009-04-20 20:55:07 UTC
(In reply to comment #15)
> Paul, how is it going?

I seem to remember having poked at a solution (but having trouble to decide where to stop worrying about corner cases). Anyway, I hope to get back to this one of these days, as it would be a shame to go through all this trouble to make this parser easier to debug/understand/etc. without actually fixing this.

Please prod me again if this takes too long. 

Of course, I have little to complain about if someone fixes this while still I'm working on it ...
Comment 19 Nick Jenkins 2009-04-21 02:05:35 UTC
If it helps anyone, here's my personal test case I use to generate a good and a bad email for this bug. Run it from the command line, need to have command-line PHP installed, should all be on one line (bugzilla may mangle this), and obviously update the $my_email variable:

php -r '$my_email="nickpj@gmail.com"; mail($my_email, "test subject - broken", "message body", "From: y.our Webmaster <webmaster@whatever.com>"); mail($my_email, "test subject - works", "message body", "From: your Webmaster <webmaster@whatever.com>");'
Comment 20 Paul Bolle 2009-04-27 18:43:28 UTC
*** Bug 343344 has been marked as a duplicate of this bug. ***
Comment 21 bugzilla.gnome.org 2009-07-16 15:20:58 UTC
Happens to me with 2.26.2 also.
Comment 22 Milan Crha 2009-07-16 15:23:01 UTC
(In reply to comment #18)
> Please prod me again if this takes too long. 

Second attempt. :)
Comment 23 Paul Bolle 2009-11-25 14:21:02 UTC
(In reply to comment #22)
> Second attempt. :)

0) Just played with my silly test program again. (The patch still applies to camel-mime-utils.c as shipped with evolution-data-server 2.29.2)

1) I was adding some horrific hack to keep all spaces before and after "unquoted" dots. Then I decided to test an address starting with a "unquoted" dot.
Current parser:
    ./347520 ".com Patch Queue Manager <pqm@pqm.ubuntu.com>"
    [...]
    name: .
    addr: com Patch Queue Manager pqm@pqm.ubuntu.com
Parser patched with the trivial patch of comment #12: 
    ./347520 ".com Patch Queue Manager <pqm@pqm.ubuntu.com>"
    [...]
    name: 
    addr: .com Patch Queue Manager pqm@pqm.ubuntu.com

So I don't think the patch of comment #12 helps much.

2) I think the trivial fix of comment #3 has still not been found.

3) If it turns out a trivial fix is not actually possible, it would probably be beneficial to have lists of:
- valid addresses;
- common invalid addresses;
all with their desired parsing into a "name" and an "addr" part (or something equivalent).

(And for myself, a better understanding of rfc2822 and the current parser would also be nice).

4) Related issue: how should evolution handle invalid addresses that cannot be sanitized? Should those invalid addresses be displayed "as is" in the header area but not be used at all in editors for replies?
Comment 24 Milan Crha 2010-10-01 14:21:57 UTC
*** Bug 617609 has been marked as a duplicate of this bug. ***
Comment 25 Milan Crha 2010-10-08 07:24:26 UTC
Created attachment 171944 [details] [review]
eds patch

for evolution-data-server;

Maybe not so smart, but it works. The tests seems to pass as well, and I added some for this thing too, thus the distcheck should spot any issue before release.
Feel free to add more formats/addresses to the test.
Comment 26 Milan Crha 2010-10-08 07:34:19 UTC
Created commit a27b2b0 in eds master (2.91.1+)
Created commit 92610ee in eds gnome-2-32 (2.32.1+)
Comment 27 H. İbrahim Güngör 2010-12-16 12:30:01 UTC
I still reproduce the issue. Full name-> H. İbrahim Güngör  (attention to the "İ" character which is Turkish specific.)

You can read the test case here: bug #617609

evolution-data-server: 2.32.1
evolution: 2.32.1
Comment 28 André Klapper 2010-12-16 13:26:15 UTC
(In reply to comment #27)
> evolution-data-server: 2.32.1
> evolution: 2.32.1

Please see the version information in comment 26 again.
Comment 29 H. İbrahim Güngör 2010-12-16 14:41:21 UTC
(In reply to comment #28)
> (In reply to comment #27)
> > evolution-data-server: 2.32.1
> > evolution: 2.32.1
> 
> Please see the version information in comment 26 again.

Ah, sorry. Thanks
Comment 30 Akhil Laddha 2011-10-13 07:21:31 UTC
*** Bug 550787 has been marked as a duplicate of this bug. ***
Comment 31 Akhil Laddha 2011-10-13 08:17:54 UTC
*** Bug 559087 has been marked as a duplicate of this bug. ***