summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2023-11-10 12:29:58 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2023-11-10 12:41:54 +0000
commit6b61358cc8783b17c44a9d3ca1bdb18809e9f345 (patch)
tree705a23aba0899c4be41558da33d8568892e8bc47
parentc1dee1e9c2d1430b3daa015f206b7d9087f570f6 (diff)
setup_sigwarn: explain why "warnings" aren't fatal (though "warn" is)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r--Debian/Dgit.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index 8ad3e3d..2c76263 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -159,6 +159,17 @@ sub forkcheck_mainprocess () {
}
sub setup_sigwarn () {
+ # $SIG{__WARN__} affects `warn` but not `-w` (`use warnings`).
+ # Ideally we would fatalise all warnings. However:
+ # 1. warnings(3perl) has a long discussion of why this is
+ # a bad idea due to bugs in, well, everything.
+ # 2. So maybe we would want to do that only when running the tests,
+ # 3. However, because it's a lexical keyword it's difficult to
+ # manipulate at runtime. We could use the caller's ^H
+ # via caller, but that would take effect only in the main
+ # program (which calls setup_sigwarn, eg dgit.git/dgit),
+ # and not in the modules.
+ # This is all swimming too much upstream.
forkcheck_setup();
$SIG{__WARN__} = sub {
confess $_[0] if forkcheck_mainprocess;