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,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 440F31F405 for ; Wed, 7 Feb 2024 22:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1707346454; bh=QvQPTjbFafm/ade7GC6WHBAQjCfH+ENfdENa+XA7HUc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=wIwyAkXjMAL+xKPF0tIx1vwAfKXV9dWv0/FHIz6hpgr7Wlb5gWCPSI8R4FGe8rPVc gCnLdZk/aqP3uBhm0cZkJIH9jo6DwrLYAKEX8CS4bIn0HmCNsMen+TIKKZ6AxK4Rvq 0HZBj166KdjH31/IoOrlYzGNt3E/kCdg5GiEmOTc= Date: Wed, 7 Feb 2024 22:49:19 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH v2] daemon: quiet Email::Address::XS warnings properly Message-ID: <20240207224919.M669761@dcvr> References: <20240202092459.2802045-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240202092459.2802045-1-e@80x24.org> List-Id: Eric Wong wrote: > index a2c1ed6e..7aee5c72 100644 > --- a/lib/PublicInbox/Daemon.pm > +++ b/lib/PublicInbox/Daemon.pm > @@ -698,7 +701,6 @@ sub run { > # localize GCF2C for tests: > local $PublicInbox::GitAsyncCat::GCF2C; > local $PublicInbox::Git::async_warn = 1; > - local $SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb(); > local %WORKER_SIG = %WORKER_SIG; > local %POST_ACCEPT; That 2nd hunk is still necessary due to ->event_step callbacks from asynchronous git blob retrievals. It wasn't 100% correct, since it can put warnings in the wrong file, though... --------8<------- Subject: [PATCH] daemon: quiet Email::Address::XS warnings properly Setting $SIG{__WARN__} at the top-level no longer has any effect since we localize $SIG{__WARN__} when entering ->event_step on a per-listener basis. Fixes: 60d262483a4d (daemon: use per-listener SIG{__WARN__} callbacks, 2022-08-08) --- lib/PublicInbox/Daemon.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index a2c1ed6e..e578f2e8 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -143,8 +143,11 @@ sub load_mod ($;$$) { $tlsd->{$f} = $logs{$p} //= open_log_path(my $fh, $p); warn "# $scheme://$addr $f=$p\n"; } + # for per-listener $SIG{__WARN__}: my $err = $tlsd->{err}; - $tlsd->{warn_cb} = sub { print $err @_ }; # for local $SIG{__WARN__} + $tlsd->{warn_cb} = sub { + print $err @_ unless PublicInbox::Eml::warn_ignore(@_) + }; $opt->{'multi-accept'} and $xn{'multi-accept'} = $opt->{'multi-accept'}->[-1]; \%xn;