From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6315 166.70.0.0/16 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DF0CA1F4C0; Tue, 15 Oct 2019 23:06:19 +0000 (UTC) Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1iKVtS-00007b-1r; Tue, 15 Oct 2019 17:06:18 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1iKVtR-0006fu-1b; Tue, 15 Oct 2019 17:06:17 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Eric Wong Cc: meta@public-inbox.org References: <87imp05hlm.fsf@alyssa.is> <20191008001050.rwd7bh7cek7qrydi@dcvr> <87wodfctwd.fsf@x220.int.ebiederm.org> <20191008221108.3wsso25kviiwd7ek@dcvr> <87wodec1um.fsf@x220.int.ebiederm.org> <20191008224104.GA24142@dcvr> <87h84ibb9m.fsf@x220.int.ebiederm.org> <87wode9vxw.fsf_-_@x220.int.ebiederm.org> <87muea9vut.fsf_-_@x220.int.ebiederm.org> <20191015202600.GA10270@dcvr> Date: Tue, 15 Oct 2019 18:05:24 -0500 In-Reply-To: <20191015202600.GA10270@dcvr> (Eric Wong's message of "Tue, 15 Oct 2019 20:26:00 +0000") Message-ID: <87o8yhzk23.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1iKVtR-0006fu-1b;;;mid=<87o8yhzk23.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+s+cnC4XQJ7yTx6dgUvlv6O+NMnZccvvk= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH 1/4] PublicInbox::Import Smuggle a raw message into add X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) List-Id: Eric Wong writes: > "Eric W. Biederman" wrote: >> >> Date: Tue, 15 Jan 2019 16:36:42 -0600 >> >> I don't trust the MIME type to not munge my email messages in horrible >> ways upon occasion. Therefore allow for passing in the raw message >> value instead of trusting the mime object to preserve it. >> >> Signed-off-by: "Eric W. Biederman" >> --- >> >> As we discussed last time I was working to merge my imap import script. > > Thanks, pushed with the following interdiff: > > diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm > index b17c9d5c..e1f48771 100644 > --- a/lib/PublicInbox/Import.pm > +++ b/lib/PublicInbox/Import.pm > @@ -394,8 +394,7 @@ sub add { > } > > my $blob = $self->{mark}++; > - my $raw_email = $mime->{-public_inbox_raw}; > - $raw_email ||= $mime->as_string; > + my $raw_email = $mime->{-public_inbox_raw} // $mime->as_string; > my $n = length($raw_email); > $self->{bytes_added} += $n; > print $w "blob\nmark :$blob\ndata ", $n, "\n" or wfail; Looks good. I hadn't realized that // was an operator in perl. It is nice to see. Eric