dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 16/16] enable warnings globally
Date: Sun,  1 Oct 2023 02:43:23 +0000	[thread overview]
Message-ID: <20231001024323.1960491-16-e@80x24.org> (raw)
In-Reply-To: <20231001024323.1960491-1-e@80x24.org>

---
 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 <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 # 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

      parent reply	other threads:[~2023-10-01  2:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01  2:43 [PATCH 01/16] git: decouple cat_async_retry from POSIX pipe semantics Eric Wong
2023-10-01  2:43 ` [PATCH 02/16] git: use Unix stream sockets for `cat-file --batch-*' Eric Wong
2023-10-01  2:43 ` [PATCH 03/16] git+gcf2client: switch to level-triggered wakeups Eric Wong
2023-10-01  2:43 ` [PATCH 04/16] gcf2: Eric Wong
2023-10-01  2:43 ` [PATCH 05/16] t/git: show git_version in diag output Eric Wong
2023-10-01  2:43 ` [PATCH 06/16] process_pipe: do not run `close' perlop unless requested Eric Wong
2023-10-01  2:43 ` [PATCH 07/16] git: improve error reporting Eric Wong
2023-10-01  2:43 ` [PATCH 08/16] git: packed_bytes: account for TOUTTOC between glob and stat Eric Wong
2023-10-01  2:43 ` [PATCH 09/16] gcf2client: warnings Eric Wong
2023-10-01  2:43 ` [PATCH 10/16] lei rediff: order-file support Eric Wong
2023-10-01  2:43 ` [PATCH 11/16] lei: correct exit signal Eric Wong
2023-10-01  2:43 ` [PATCH 12/16] lei mail-diff: remove correct temporary directory Eric Wong
2023-10-01  2:43 ` [PATCH 13/16] lei rediff: perl -e instead of -E Eric Wong
2023-10-01  2:43 ` [PATCH 14/16] lei_store: unlink early Eric Wong
2023-10-01  2:43 ` [PATCH 15/16] overidx: fix version comparison Eric Wong
2023-10-01  2:43 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231001024323.1960491-16-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).