user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] t/spawn: fix with unusual env locations
@ 2019-09-15 13:48 Alyssa Ross
  2019-09-15 18:55 ` Eric Wong
  0 siblings, 1 reply; 12+ messages in thread
From: Alyssa Ross @ 2019-09-15 13:48 UTC (permalink / raw)
  To: meta; +Cc: Alyssa Ross

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-15 13:48 [PATCH] t/spawn: fix with unusual env locations Alyssa Ross
2019-09-15 18:55 ` Eric Wong
2019-09-24  1:11   ` Alyssa Ross
2019-09-24  4:01     ` Eric Wong
2019-09-24 22:12       ` Test failures in build sandbox Alyssa Ross
2019-09-26  8:44         ` Eric Wong
2019-10-02 23:23           ` Alyssa Ross
2019-10-03  0:46             ` Alyssa Ross
2019-10-03  1:28               ` Eric Wong
2019-10-03  1:43                 ` Alyssa Ross
2019-10-03  7:57                   ` [PATCH] t/search: bail out on `git init --shared' failures Eric Wong
2019-10-03 10:15                     ` Alyssa Ross

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git