From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 317481FA13 for ; Thu, 14 Jan 2021 07:06:28 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 03/14] daemon+watch: fix localization of %SIG for non-signalfd users Date: Wed, 13 Jan 2021 19:06:16 -1200 Message-Id: <20210114070627.18195-4-e@80x24.org> In-Reply-To: <20210114070627.18195-1-e@80x24.org> References: <20210114070627.18195-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It turns out "local" did not take effect in the way we used it: http://nntp.perl.org/group/perl.perl5.porters/258784 Fortunately, none of the old use cases seem affected, unlike the previous lei change to ensure consistent SIGPIPE handling. --- lib/PublicInbox/Daemon.pm | 4 ++-- script/public-inbox-watch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 4b738b7c..f5543c85 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -514,7 +514,7 @@ EOF CHLD => \&reap_children, }; my $sigfd = PublicInbox::Sigfd->new($sig, 0); - local %SIG = (%SIG, %$sig) if !$sigfd; + local @SIG{keys %$sig} = values(%$sig) unless $sigfd; PublicInbox::DS::sig_setmask($oldset) if !$sigfd; while (1) { # main loop my $n = scalar keys %pids; @@ -628,7 +628,7 @@ sub daemon_loop ($$$$) { PublicInbox::Listener->new($_, $tls_cb || $post_accept) } @listeners; my $sigfd = PublicInbox::Sigfd->new($sig, SFD_NONBLOCK); - local %SIG = (%SIG, %$sig) if !$sigfd; + local @SIG{keys %$sig} = values(%$sig) unless $sigfd; if (!$sigfd) { # wake up every second to accept signals if we don't # have signalfd or IO::KQueue: diff --git a/script/public-inbox-watch b/script/public-inbox-watch index 10c7cd6f..86349d71 100755 --- a/script/public-inbox-watch +++ b/script/public-inbox-watch @@ -58,7 +58,7 @@ if ($watch) { PublicInbox::DS::requeue($scan) if $do_scan; my $sigfd = PublicInbox::Sigfd->new($sig, SFD_NONBLOCK); - local %SIG = (%SIG, %$sig) if !$sigfd; + local @SIG{keys %$sig} = values(%$sig) unless $sigfd; if (!$sigfd) { PublicInbox::DS::sig_setmask($oldset); PublicInbox::DS->SetLoopTimeout(1000);