[libemail-address-perl] 03/04: Add more upstream changes to avoid slowdowns when parsing phrases

Salvatore Bonaccorso carnil at debian.org
Fri Jun 27 18:10:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

carnil pushed a commit to branch wheezy
in repository libemail-address-perl.

commit 0a098efe666048f8232473e3760ebeae0af54b1e
Author: Salvatore Bonaccorso <carnil at debian.org>
Date:   Wed Jun 25 22:34:46 2014 +0200

    Add more upstream changes to avoid slowdowns when parsing phrases
---
 ...have-a-phrase-do-not-backtrack-through-it.patch | 20 +++++++++++++
 ...-not-be-fooled-by-addresses-in-the-phrase.patch | 35 ++++++++++++++++++++++
 ...nal-angle-addr-in-the-parse-contains-addr.patch | 26 ++++++++++++++++
 debian/patches/series                              |  3 ++
 4 files changed, 84 insertions(+)

diff --git a/debian/patches/0002-once-we-have-a-phrase-do-not-backtrack-through-it.patch b/debian/patches/0002-once-we-have-a-phrase-do-not-backtrack-through-it.patch
new file mode 100644
index 0000000..2c8f384
--- /dev/null
+++ b/debian/patches/0002-once-we-have-a-phrase-do-not-backtrack-through-it.patch
@@ -0,0 +1,20 @@
+From 43bc3ea102cc41f4b20da4c1a0c73db6fac2b457 Mon Sep 17 00:00:00 2001
+From: Ricardo Signes <rjbs at cpan.org>
+Date: Sat, 14 Jun 2014 00:10:39 -0400
+Subject: [PATCH 2/8] once we have a phrase, do not backtrack through it
+
+---
+ lib/Email/Address.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lib/Email/Address.pm
++++ b/lib/Email/Address.pm
+@@ -141,7 +141,7 @@ following comment.
+ 
+ $addr_spec  = qr/$local_part\@$domain/;
+ $angle_addr = qr/$cfws*<$addr_spec>$cfws*/;
+-$name_addr  = qr/$display_name?$angle_addr/;
++$name_addr  = qr/(?>$display_name?)$angle_addr/;
+ $mailbox    = qr/(?:$name_addr|$addr_spec)$comment*/;
+ 
+ sub _PHRASE   () { 0 }
diff --git a/debian/patches/0004-do-not-be-fooled-by-addresses-in-the-phrase.patch b/debian/patches/0004-do-not-be-fooled-by-addresses-in-the-phrase.patch
new file mode 100644
index 0000000..f066150
--- /dev/null
+++ b/debian/patches/0004-do-not-be-fooled-by-addresses-in-the-phrase.patch
@@ -0,0 +1,35 @@
+From b9d36d986dd6ddc6f8de39e8f577bde502ece278 Mon Sep 17 00:00:00 2001
+From: Ricardo Signes <rjbs at cpan.org>
+Date: Sat, 14 Jun 2014 00:16:58 -0400
+Subject: [PATCH 4/8] do not be fooled by addresses in the phrase
+
+---
+ t/tests.t | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/t/tests.t b/t/tests.t
+index 038aaec..5ce5767 100644
+--- a/t/tests.t
++++ b/t/tests.t
+@@ -1618,7 +1618,17 @@ my @list = (
+         undef,
+       ],
+     ],
+-  ]
++  ],
++  [
++    q{"<fake-- ATAT --bogus.biz>" <real-- ATAT --actual.mil>},
++    [
++      [
++        '<fake-- ATAT --bogus.biz>',
++        'real-- ATAT --actual.mil',
++        undef,
++      ],
++    ],
++  ],
+ );
+ 
+ my $tests = 1;
+-- 
+2.0.0
+
diff --git a/debian/patches/0005-only-the-final-angle-addr-in-the-parse-contains-addr.patch b/debian/patches/0005-only-the-final-angle-addr-in-the-parse-contains-addr.patch
new file mode 100644
index 0000000..90805f4
--- /dev/null
+++ b/debian/patches/0005-only-the-final-angle-addr-in-the-parse-contains-addr.patch
@@ -0,0 +1,26 @@
+From a53513e3a07c3f9dde99158c22273ba51be40fae Mon Sep 17 00:00:00 2001
+From: Ricardo Signes <rjbs at cpan.org>
+Date: Sat, 14 Jun 2014 00:17:19 -0400
+Subject: [PATCH 5/8] only the final angle-addr in the parse contains addr
+
+this is such a bodge :(
+---
+ lib/Email/Address.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Email/Address.pm b/lib/Email/Address.pm
+index a50402e..acece12 100644
+--- a/lib/Email/Address.pm
++++ b/lib/Email/Address.pm
+@@ -221,7 +221,7 @@ sub parse {
+       s/$comment//go if @comments;
+ 
+       my ($user, $host, $com);
+-      ($user, $host) = ($1, $2) if s/<($local_part)\@($domain)>//o;
++      ($user, $host) = ($1, $2) if s/<($local_part)\@($domain)>\s*\z//o;
+       if (! defined($user) || ! defined($host)) {
+           s/($local_part)\@($domain)//o;
+           ($user, $host) = ($1, $2);
+-- 
+2.0.0
+
diff --git a/debian/patches/series b/debian/patches/series
index c447d49..ad076be 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,6 @@
 spelling.patch
 0001-correct-expectation-the-phrase-looks-like-an-angle-a.patch
+0002-once-we-have-a-phrase-do-not-backtrack-through-it.patch
+0004-do-not-be-fooled-by-addresses-in-the-phrase.patch
+0005-only-the-final-angle-addr-in-the-parse-contains-addr.patch
 0008-quoted-part-can-be-empty.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libemail-address-perl.git



More information about the Pkg-perl-cvs-commits mailing list