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: AS11403 64.147.123.0/24 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 9B5621F463 for ; Sun, 15 Sep 2019 13:48:56 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 9C1695CF; Sun, 15 Sep 2019 09:48:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 15 Sep 2019 09:48:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=y9RZ+0IHjTDlppBG3XLGw8ra2Z pvjrgOlgkVau+EG1w=; b=hL5mOWtvP7JgKDthCCdR0/w/Xag2FTQU6ambN7y5Tc lDvPzN/iV4vZSAKjPcRviJuyc8dPZLYZ0aNYGGFoPeIINnPN2XXggnjk1fMf7AF3 YntEfFebhP0tyFcFaJEO3Y0kK4lOPHli9eCu7L/2KqEH+JwdPCu8cDmNlcX7MJaw 6A39TisjJfK/Diq+hRdzb3W77q8rjQTGK0CjkRgyExZhNUctPRMciU6X7Tl3A0ZC /yHMezvyg99WdgD8VDRNW4Ly30dBXchSTTzjFLhDnEwYOXzkaWg1JYUKpFjSHXg4 dut94Rrj70BTFvKtfdGq4XwfdAbDZMtT+cAIortLqX+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=y9RZ+0IHjTDlppBG3 XLGw8ra2ZpvjrgOlgkVau+EG1w=; b=LLTkUPxrpsdOYLLTyr0GRtuJc0MFolTAj Twjz+agb6UR58jUUFek2W/4l7UXxJwzmicg57rnFUn0oc9Dta0mlkCqJGPX+txhI k8xuYsfT/I6g9hzBRBN2rvEadpo7WE/1acQ/O7y8Lz/8htb6VlVppO2BFbxpLZWT 7dU7Qv0mNqYsa7O1ALO4fc6Al2LWT7oumhLArVWu7zDnMe3Ub0TDxLo6I8AO+4St uVtiZ8kBZb8m9izDA+LqLgDHvZm3jGvW4bvWn6MN6OSHjxlyrAfcC/NxFTKRptAi Cz1q2gvGkqGt5EPdB6WWqHyZRUExZFuOEwjM4uyKOEwl7gIcYu9LQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddugdejtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpeetlhihshhsrgcutfhoshhsuceohhhisegrlhihshhsrgdrihhsqeen ucfkphepkedurddukeejrddvvdegrddufedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hhihesrghlhihsshgrrdhishenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (130.224.187.81.in-addr.arpa [81.187.224.130]) by mail.messagingengine.com (Postfix) with ESMTPA id 7FBE8D6005A; Sun, 15 Sep 2019 09:48:53 -0400 (EDT) From: Alyssa Ross To: meta@public-inbox.org Cc: Alyssa Ross Subject: [PATCH] t/spawn: fix with unusual env locations Date: Sun, 15 Sep 2019 13:48:20 +0000 Message-Id: <20190915134819.1406-1-hi@alyssa.is> X-Mailer: git-send-email 2.22.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The call to spawn clears the environment, including PATH. This means that an env in a non-default location wouldn't be found, while all the other tests work because they use PATH. We can fix this by looking up which PATH to use beforehand. I ran into this when packaging public-inbox for Nixpkgs. We build in a chroot, and in this case the env I wanted to use was at /nix/store/7rmjki86923bw1inx0czpp4wgy0kk687-coreutils-8.31/bin/env. --- t/spawn.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/spawn.t b/t/spawn.t index aba1a26..5549ca8 100644 --- a/t/spawn.t +++ b/t/spawn.t @@ -41,7 +41,8 @@ use PublicInbox::Spawn qw(which spawn popen_rd); { my ($r, $w); pipe $r, $w or die "pipe failed: $!"; - my $pid = spawn(['env'], {}, { -env => 1, 1 => fileno($w) }); + my $env = which('env'); + my $pid = spawn([$env], {}, { -env => 1, 1 => fileno($w) }); close $w or die "close pipe[1] failed: $!"; ok(!defined(<$r>), 'read stdout of spawned from pipe'); is(waitpid($pid, 0), $pid, 'waitpid succeeds on spawned process'); -- 2.22.1