From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5CB3B1F572 for ; Sun, 1 Oct 2023 02:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1696128206; bh=O6kDgRLxh7RjIoQyJeeEs84McDvx/FkyhfIng8/NUOk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ydo6qr2Y+nJdLdaIFJQePuNXnIKqv4fFgQ18XIoSprKL+EcPVC2Mp3CoYxwTeDhyA FqGi9c8P7GR6vCmXukvD2OcCvMd7KYVK2V2FP7SIJvsc17XQ5ICUEODOBywzTM9grR HEgmPt5+J3WAmLagavZr8L+xz45o1fDg1ICL51f4= From: Eric Wong To: spew@80x24.org Subject: [PATCH 16/16] enable warnings globally Date: Sun, 1 Oct 2023 02:43:23 +0000 Message-ID: <20231001024323.1960491-16-e@80x24.org> In-Reply-To: <20231001024323.1960491-1-e@80x24.org> References: <20231001024323.1960491-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- script/lei | 4 ++-- t/edit.t | 29 +++++++++++++++-------------- t/extsearch.t | 2 +- t/lei-q-save.t | 4 ++-- t/mbox_reader.t | 2 +- t/spawn.t | 4 ++-- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/script/lei b/script/lei index a77ea880..1d90be0a 100755 --- a/script/lei +++ b/script/lei @@ -92,8 +92,8 @@ my $addr = pack_sockaddr_un($path); socket($sock, AF_UNIX, SOCK_SEQPACKET, 0) or die "socket: $!"; unless (connect($sock, $addr)) { # start the daemon if not started local $ENV{PERL5LIB} = join(':', @INC); - open(my $daemon, '-|', $^X, qw[-MPublicInbox::LEI - -E PublicInbox::LEI::lazy_start(@ARGV)], + open(my $daemon, '-|', $^X, $^W ? ('-w') : (), + qw[-MPublicInbox::LEI -e PublicInbox::LEI::lazy_start(@ARGV)], $path, $! + 0, $narg) or die "popen: $!"; while (<$daemon>) { warn $_ } # EOF when STDERR is redirected close($daemon) or warn <<""; diff --git a/t/edit.t b/t/edit.t index e6e0f9cf..1621df3b 100644 --- a/t/edit.t +++ b/t/edit.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2019-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # edit frontend behavior test (t/replace.t for backend) use strict; @@ -24,10 +24,11 @@ local $ENV{PI_CONFIG} = $cfgfile; my ($in, $out, $err, $cmd, $cur, $t); my $git = PublicInbox::Git->new("$ibx->{inboxdir}/git/0.git"); my $opt = { 0 => \$in, 1 => \$out, 2 => \$err }; +my $ipe = "$^X -w -i -p -e"; $t = '-F FILE'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean prefix/bool pfx/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/boolean prefix/bool pfx/'"; $cmd = [ '-edit', "-F$file", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t edit OK"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); @@ -37,7 +38,7 @@ $t = '-F FILE'; { $t = '-m MESSAGE_ID'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/bool pfx/boolean prefix/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t edit OK"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); @@ -48,7 +49,7 @@ $t = '-m MESSAGE_ID'; { $t = 'no-op -m MESSAGE_ID'; { $in = $out = $err = ''; my $before = $git->qx(qw(rev-parse HEAD)); - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/bool pfx/boolean prefix/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds"); my $prev = $cur; @@ -64,7 +65,7 @@ $t = 'no-op -m MESSAGE_ID'; { $t = 'no-op -m MESSAGE_ID w/Status: header'; { # because mutt does it $in = $out = $err = ''; my $before = $git->qx(qw(rev-parse HEAD)); - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Status: RO\\n\$&/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^Subject:.*/Status: RO\\n\$&/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds"); my $prev = $cur; @@ -80,7 +81,7 @@ $t = 'no-op -m MESSAGE_ID w/Status: header'; { # because mutt does it $t = '-m MESSAGE_ID can change Received: headers'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Received: x\\n\$&/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^Subject:.*/Received: x\\n\$&/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); @@ -91,7 +92,7 @@ $t = '-m MESSAGE_ID can change Received: headers'; { $t = '-m miss'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean/FAIL/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/boolean/FAIL/'"; $cmd = [ '-edit', "-m$mid-miss", $inboxdir ]; ok(!run_script($cmd, undef, $opt), "$t fails on invalid MID"); like($err, qr/No message found/, "$t shows error"); @@ -99,7 +100,7 @@ $t = '-m miss'; { $t = 'non-interactive editor failure'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 'END { exit 1 }'"; + local $ENV{MAIL_EDITOR} = "$ipe 'END { exit 1 }'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(!run_script($cmd, undef, $opt), "$t detected"); like($err, qr/END \{ exit 1 \}' failed:/, "$t shows error"); @@ -109,7 +110,7 @@ $t = 'mailEditor set in config'; { $in = $out = $err = ''; my $rc = xsys(qw(git config), "--file=$cfgfile", 'publicinbox.maileditor', - "$^X -i -p -e 's/boolean prefix/bool pfx/'"); + "$ipe 's/boolean prefix/bool pfx/'"); is($rc, 0, 'set publicinbox.mailEditor'); local $ENV{MAIL_EDITOR}; delete $ENV{MAIL_EDITOR}; @@ -123,20 +124,20 @@ $t = 'mailEditor set in config'; { $t = '--raw and mbox escaping'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^\$/\\nFrom not mbox\\n/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^\$/\\nFrom not mbox\\n/'"; $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); like($cur->body, qr/^From not mbox/sm, 'put "From " line into body'); - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^>From not/\$& an/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^>From not/\$& an/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds with mbox escaping"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); like($cur->body, qr/^From not an mbox/sm, 'changed "From " line unescaped'); - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^From not an mbox\\n//s'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^From not an mbox\\n//s'"; $cmd = [ '-edit', "-m$mid", '--raw', $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds again"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); @@ -154,7 +155,7 @@ $t = 'reuse Message-ID'; { $t = 'edit ambiguous Message-ID with -m'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/bool pfx/boolean prefix/'"; $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(!run_script($cmd, undef, $opt), "$t fails w/o --force"); like($err, qr/Multiple messages with different content found matching/, @@ -164,7 +165,7 @@ $t = 'edit ambiguous Message-ID with -m'; { $t .= ' and --force'; { $in = $out = $err = ''; - local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Subject:x/i'"; + local $ENV{MAIL_EDITOR} = "$ipe 's/^Subject:.*/Subject:x/i'"; $cmd = [ '-edit', "-m$mid", '--force', $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t succeeds"); like($err, qr/Will edit all of them/, "$t notes all will be edited"); diff --git a/t/extsearch.t b/t/extsearch.t index 19eaf3b5..2995cf95 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -151,7 +151,7 @@ if ('inbox edited') { my ($in, $out, $err); $in = $out = $err = ''; my $opt = { 0 => \$in, 1 => \$out, 2 => \$err }; - my $env = { MAIL_EDITOR => "$^X -i -p -e 's/test message/BEST MSG/'" }; + my $env = { MAIL_EDITOR => "$^X -w -i -p -e 's/test message/BEST MSG/'" }; my $cmd = [ qw(-edit -Ft/utf8.eml), "$home/v2test" ]; ok(run_script($cmd, $env, $opt), '-edit'); ok(run_script([qw(-extindex --all), "$home/extindex"], undef, $opt), diff --git a/t/lei-q-save.t b/t/lei-q-save.t index d09c8397..1d9d5a51 100644 --- a/t/lei-q-save.t +++ b/t/lei-q-save.t @@ -227,7 +227,7 @@ test_lei(sub { my @lss = glob("$home/" . '.local/share/lei/saved-searches/*/lei.saved-search'); my $out = xqx([qw(git config -f), $lss[0], 'lei.q.output']); - xsys($^X, qw(-i -p -e), "s/\\[/\\0/", $lss[0]) + xsys($^X, qw(-w -i -p -e), "s/\\[/\\0/", $lss[0]) and xbail "-ipe $lss[0]: $?"; lei_ok qw(ls-search); like($lei_err, qr/bad config line.*?\Q$lss[0]\E/, @@ -235,7 +235,7 @@ test_lei(sub { lei_ok qw(up --all), \'up works with bad config'; like($lei_err, qr/bad config line.*?\Q$lss[0]\E/, 'git config parse error shown w/ lei up'); - xsys($^X, qw(-i -p -e), "s/\\0/\\[/", $lss[0]) + xsys($^X, qw(-w -i -p -e), "s/\\0/\\[/", $lss[0]) and xbail "-ipe $lss[0]: $?"; lei_ok qw(ls-search); is($lei_err, '', 'no errors w/ fixed config'); diff --git a/t/mbox_reader.t b/t/mbox_reader.t index 87e8f397..ad74bb39 100644 --- a/t/mbox_reader.t +++ b/t/mbox_reader.t @@ -113,7 +113,7 @@ EOM SKIP: { use PublicInbox::Spawn qw(popen_rd); - my $fh = popen_rd([ $^X, '-E', <<'' ]); + my $fh = popen_rd([ $^X, '-w', '-E', <<'' ]); say "From x@y Fri Oct 2 00:00:00 1993"; print "a: b\n\n", "x" x 70000, "\n\n"; say "From x@y Fri Oct 2 00:00:00 2010"; diff --git a/t/spawn.t b/t/spawn.t index 9ed3be36..04589437 100644 --- a/t/spawn.t +++ b/t/spawn.t @@ -62,7 +62,7 @@ elsif ($pid > 0) { } EOF my $oldset = PublicInbox::DS::block_signals(); - my $rd = popen_rd([$^X, '-e', $script]); + my $rd = popen_rd([$^X, qw(-w -e), $script]); diag 'waiting for child to reap grandchild...'; chomp(my $line = readline($rd)); my ($rdy, $pid) = split(/ /, $line); @@ -185,7 +185,7 @@ SKIP: { require BSD::Resource; defined(BSD::Resource::RLIMIT_CPU()) } or skip 'BSD::Resource::RLIMIT_CPU missing', 3; - my $cmd = [ $^X, ($^W ? ('-w') : ()), '-e', <<'EOM' ]; + my $cmd = [ $^X, qw(-w -e), <<'EOM' ]; use POSIX qw(:signal_h); use BSD::Resource qw(times); use Time::HiRes qw(time); # gettimeofday