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-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,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 32F471F9F4 for ; Mon, 13 Sep 2021 20:53:56 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/6] lei up: localize %ENV in redispatch Date: Mon, 13 Sep 2021 20:53:53 +0000 Message-Id: <20210913205355.13002-5-e@80x24.org> In-Reply-To: <20210913205355.13002-1-e@80x24.org> References: <20210913205355.13002-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We need to restore %ENV of script/lei in case another lei client has a different %ENV than what daemon has. --- lib/PublicInbox/LeiUp.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index be476427..a16117c9 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@ -55,13 +55,14 @@ sub up1 ($$) { sub up1_redispatch { my ($lei, $out, $op_p) = @_; my $l = bless { %$lei }, ref($lei); - $l->{opt} = { %{$l->{opt}} }; + $l->{opt} = { %{$l->{opt}} }; # deep copy delete $l->{sock}; # do not close $l->{''} = $op_p; # daemon only ($l => $lei => script/lei) # make close($l->{1}) happy in lei->dclose open my $fh, '>&', $l->{1} or return $l->child_error(0, "dup: $!"); local $PublicInbox::LEI::current_lei = $l; + local %ENV = %{$l->{env}}; $l->{1} = $fh; eval { $l->qerr("# updating $out");