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 74A611F452 for ; Wed, 15 Nov 2023 09:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1700040107; bh=1KgzhVVLPbDU83hdZF5CiLdIB2HjTirrnnmBwc/7IGI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PXx5ktQm5+3Q+A5wa3lcdKr3MqB2lc/QJ0ArtdwapbkooM3qy6YkSYv139HncVEX0 GdpeI/Sk1sfzANXO55I9jw0OPQxdG0jLvYH7I/vB5NFpEfkRoNGrC7WxXsAIvp9oVg c/xYCWyGpQb/mY9OgXz/7rKZ39q/A4+R8otIKjYU= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/4] lei: fix idempotent STDERR redirect in workers Date: Wed, 15 Nov 2023 09:21:42 +0000 Message-Id: <20231115092145.1131822-2-e@80x24.org> In-Reply-To: <20231115092145.1131822-1-e@80x24.org> References: <20231115092145.1131822-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is needed to support forking from already-forked lei workers and $lei->{2} is already STDERR. Fixes: e015c3742f91 (lei: use autodie where appropriate, 2023-10-17) --- lib/PublicInbox/LEI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 460aed40..8d235b37 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -581,7 +581,7 @@ sub _lei_atfork_child { close($_) for (grep(defined, delete @$self{qw(0 1 2 sock)})); delete $cfg->{-lei_store}; } else { # worker, Net::NNTP (Net::Cmd) uses STDERR directly - open STDERR, '+>&', $self->{2}; + open STDERR, '+>&='.fileno($self->{2}); # idempotent w/ fileno STDERR->autoflush(1); $self->{2} = \*STDERR; POSIX::setpgid(0, $$) // die "setpgid(0, $$): $!";