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,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 0FE0B1F934 for ; Thu, 23 Sep 2021 05:53:04 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] test_common: reset umask on non-forking run_script Date: Thu, 23 Sep 2021 05:53:01 +0000 Message-Id: <20210923055303.6409-2-e@80x24.org> In-Reply-To: <20210923055303.6409-1-e@80x24.org> References: <20210923055303.6409-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: public-inbox-init sets umask for git <2.1.0, so our fork+exec replacement needs to restore the original umask of the "parent". --- lib/PublicInbox/TestCommon.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 92a7db36..aff34853 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -316,6 +316,7 @@ sub run_script ($;$$) { } else { # localize and run everything in the same process: # note: "local *STDIN = *STDIN;" and so forth did not work in # old versions of perl + my $umask = umask; local %ENV = $env ? (%ENV, %$env) : %ENV; local @SIG{keys %SIG} = map { undef } values %SIG; local $SIG{FPE} = 'IGNORE'; # Perl default @@ -333,6 +334,7 @@ sub run_script ($;$$) { die "fchdir(restore): $!" if $cwdfh && !chdir($cwdfh); _undo_redirects($orig_io); select STDOUT; + umask($umask); } # slurp the redirects back into user-supplied strings