From: Eric Wong Date: Thu, 17 Oct 2019 08:19:11 +0000 (+0000) Subject: Merge remote-tracking branch 'origin/inboxdir' X-Git-Tag: v1.2.0~32 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=fece7fca6aeac74410a813cffcb0da338017d0ed;hp=-c Merge remote-tracking branch 'origin/inboxdir' * origin/inboxdir: config: remove redundant inboxdir check config: support "inboxdir" in addition to "mainrepo" examples/grok-pull.post_update_hook: use "inbox_dir" --- fece7fca6aeac74410a813cffcb0da338017d0ed diff --combined lib/PublicInbox/WwwStream.pm index 06c8f7d2,6696cc35..0f4f55d0 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@@ -11,7 -11,8 +11,7 @@@ use strict use warnings; use PublicInbox::Hval qw(ascii_html); our $TOR_URL = 'https://www.torproject.org/'; -our $CODE_URL = 'https://public-inbox.org/'; -our $PROJECT = 'public-inbox'; +our $CODE_URL = 'https://public-inbox.org/public-inbox.git'; # noop for HTTP.pm (and any other PSGI servers) sub close {} @@@ -79,7 -80,7 +79,7 @@@ sub _html_top ($) sub code_footer ($) { my ($env) = @_; my $u = PublicInbox::Hval::prurl($env, $CODE_URL); - qq(AGPL code for this site: git clone $u $PROJECT) + qq(AGPL code for this site: git clone $u) } sub _html_end { @@@ -97,7 -98,7 +97,7 @@@ $seen{$http} = 1; for my $i (0..$max) { # old parts my be deleted: - -d "$ibx->{mainrepo}/git/$i.git" or next; + -d "$ibx->{inboxdir}/git/$i.git" or next; my $url = "$http/$i"; $seen{$url} = 1; push @urls, "$url $dir/git/$i.git"; diff --combined script/public-inbox-mda index 9b8753da,dea49dc5..584218b5 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@@ -5,8 -5,7 +5,8 @@@ # Mail delivery agent for public-inbox, run from your MTA upon mail delivery use strict; use warnings; -my $usage = 'public-inbox-mda < rfc2822_message'; +my $usage = 'public-inbox-mda [OPTIONS] < rfc2822_message'; +my $precheck = grep(/\A--no-precheck\z/, @ARGV) ? 0 : 1; my ($ems, $emm); sub do_exit { @@@ -52,13 -51,11 +52,13 @@@ if (!defined $dst) } defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown } - $dst->{mainrepo} or do_exit(67); + $dst->{inboxdir} or do_exit(67); $dst = PublicInbox::InboxWritable->new($dst); # pre-check, MDA has stricter rules than an importer might; -do_exit(0) unless PublicInbox::MDA->precheck($simple, $dst->{address}); +if ($precheck && !PublicInbox::MDA->precheck($simple, $dst->{address})) { + do_exit(0); +} $simple = undef; my $spam_ok; if ($spamc) { diff --combined t/mda.t index 92e8ad0d,1be41bcb..99592b2d --- a/t/mda.t +++ b/t/mda.t @@@ -38,7 -38,7 +38,7 @@@ my $mime my %cfg = ( "$cfgpfx.address" => $addr, - "$cfgpfx.mainrepo" => $maindir, + "$cfgpfx.inboxdir" => $maindir, ); while (my ($k,$v) = each %cfg) { is(0, system(qw(git config --file), $pi_config, $k, $v), @@@ -293,21 -293,6 +293,21 @@@ EO my $path = mid2path($mid); my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`; like($msg, qr/\Q$list_id\E/, 'delivered message w/ List-ID matches'); + + # try a message w/o precheck + $simple = Email::Simple->new(< +List-Id: <$list_id> + +this message would not be accepted without --no-precheck +EOF + $in = $simple->as_string; + my ($out, $err) = ('', ''); + IPC::Run::run([$mda, '--no-precheck'], \$in, \$out, \$err); + is($?, 0, 'mda OK with List-Id match and --no-precheck'); + my $cur = `git --git-dir=$maindir diff HEAD~1..HEAD`; + like($cur, qr/this message would not be accepted without --no-precheck/, + '--no-precheck delivered message anyways'); } done_testing();