From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 537671FAE8 for ; Wed, 28 Feb 2018 23:42:08 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 06/21] use PublicInbox::MIME consistently Date: Wed, 28 Feb 2018 23:41:47 +0000 Message-Id: <20180228234202.8839-7-e@80x24.org> In-Reply-To: <20180228234202.8839-1-e@80x24.org> References: <20180228234202.8839-1-e@80x24.org> List-Id: It works around some bugs in older Email::MIME which we'll find useful. --- lib/PublicInbox/MIME.pm | 2 ++ lib/PublicInbox/SearchIdx.pm | 2 -- lib/PublicInbox/V2Writable.pm | 2 -- lib/PublicInbox/WatchMaildir.pm | 2 -- lib/PublicInbox/WwwAttach.pm | 3 +-- script/public-inbox-learn | 2 -- script/public-inbox-mda | 4 +--- scripts/import_slrnspool | 4 ++-- scripts/import_vger_from_mbox | 3 +-- 9 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/PublicInbox/MIME.pm b/lib/PublicInbox/MIME.pm index 54925a8..456eed6 100644 --- a/lib/PublicInbox/MIME.pm +++ b/lib/PublicInbox/MIME.pm @@ -23,6 +23,8 @@ package PublicInbox::MIME; use strict; use warnings; use base qw(Email::MIME); +use Email::MIME::ContentType; +$Email::MIME::ContentType::STRICT_PARAMS = 0; if ($Email::MIME::VERSION <= 1.937) { sub parts_multipart { diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index f9207e9..0c3445d 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -11,8 +11,6 @@ use strict; use warnings; use Fcntl qw(:flock :DEFAULT); use PublicInbox::MIME; -use Email::MIME::ContentType; -$Email::MIME::ContentType::STRICT_PARAMS = 0; use base qw(PublicInbox::Search); use PublicInbox::MID qw/mid_clean id_compress mid_mime/; use PublicInbox::MsgIter; diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 3451261..5e819da 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -11,8 +11,6 @@ use PublicInbox::SearchIdxThread; use PublicInbox::MIME; use PublicInbox::Git; use PublicInbox::Import; -use Email::MIME::ContentType; -$Email::MIME::ContentType::STRICT_PARAMS = 0; # an estimate of the post-packed size to the raw uncompressed size my $PACKING_FACTOR = 0.4; diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index 403b6cf..3da6b27 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -7,8 +7,6 @@ package PublicInbox::WatchMaildir; use strict; use warnings; use PublicInbox::MIME; -use Email::MIME::ContentType; -$Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect use PublicInbox::Git; use PublicInbox::Import; use PublicInbox::MDA; diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm index 98cf9f7..b1504f5 100644 --- a/lib/PublicInbox/WwwAttach.pm +++ b/lib/PublicInbox/WwwAttach.pm @@ -5,9 +5,8 @@ package PublicInbox::WwwAttach; # internal package use strict; use warnings; -use PublicInbox::MIME; use Email::MIME::ContentType qw(parse_content_type); -$Email::MIME::ContentType::STRICT_PARAMS = 0; +use PublicInbox::MIME; use PublicInbox::MsgIter; # /$LISTNAME/$MESSAGE_ID/$IDX-$FILENAME diff --git a/script/public-inbox-learn b/script/public-inbox-learn index bdc72e0..c51f958 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -11,8 +11,6 @@ use PublicInbox::Config; use PublicInbox::Git; use PublicInbox::Import; use PublicInbox::MIME; -use Email::MIME::ContentType; -$Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect use PublicInbox::Address; use PublicInbox::Spamcheck::Spamc; my $train = shift or die "usage: $usage\n"; diff --git a/script/public-inbox-mda b/script/public-inbox-mda index 8cf4419..f1eaf62 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -15,9 +15,7 @@ sub do_exit { } use Email::Simple; -use Email::MIME; -use Email::MIME::ContentType; -$Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect +use PublicInbox::MIME; use PublicInbox::MDA; use PublicInbox::Config; use PublicInbox::Import; diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool index 5158460..7b6c9ab 100755 --- a/scripts/import_slrnspool +++ b/scripts/import_slrnspool @@ -11,7 +11,7 @@ use strict; use warnings; use PublicInbox::Config; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Import; use PublicInbox::Git; sub usage { "Usage:\n".join('',grep(/\t/, `head -n 10 $0`)) } @@ -58,7 +58,7 @@ for (; $exit == 0 && $n < $max; $n++) { open(my $fh, '<', $fn) or next; $max = $n + $max_gap; - my $mime = Email::MIME->new(eval { local $/; <$fh> }); + my $mime = PublicInbox::MIME->new(eval { local $/; <$fh> }); my $hdr = $mime->header_obj; # gmane rewrites Received headers, which increases spamminess diff --git a/scripts/import_vger_from_mbox b/scripts/import_vger_from_mbox index 1308483..8f0ec7c 100644 --- a/scripts/import_vger_from_mbox +++ b/scripts/import_vger_from_mbox @@ -5,8 +5,7 @@ use strict; use warnings; use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/; use Date::Parse qw/str2time/; -use Email::MIME; -$Email::MIME::ContentType::STRICT_PARAMS = 0; # user input is imperfect +use PublicInbox::MIME; use PublicInbox::Inbox; use PublicInbox::V2Writable; use PublicInbox::Import; -- EW