about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-14 23:10:05 +0000
committerEric Wong <e@80x24.org>2023-09-15 01:24:23 +0000
commit759885e60e59b5cdcb13c0174e6f6b4a147787f9 (patch)
tree07449d91abf4035b95ac134f1a90e59fb81c55fc /lib/PublicInbox/LeiQuery.pm
parenta3eb768e6449f493ebf3540ef4cdf010c32709b9 (diff)
downloadpublic-inbox-759885e60e59b5cdcb13c0174e6f6b4a147787f9.tar.gz
--stdin usage means the current request can be delayed
indefinitely while other requests with different %ENV
come in.  So make sure our warnings and %ENV can match
non-stdin behavior.

This probably fix segfaults during process cleanup on OpenBSD
since _lei_atfork_child use non-localized assignment of
$current_lei.  But it could be another red herring.  Either way,
it's the right thing to do from an environment replication
perspective.
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 26cfb3fd..a23354f0 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -65,6 +65,8 @@ sub qstr_add { # PublicInbox::InputPipe::consume callback for --stdin
         return $lei->{mset_opt}->{qstr} .= $_[1] if $_[1] ne '';
         eval {
                 $lei->fchdir;
+                local %ENV = %{$lei->{env}};
+                local $PublicInbox::LEI::current_lei = $lei;
                 $lei->{mset_opt}->{q_raw} = $lei->{mset_opt}->{qstr};
                 $lei->{lse}->query_approxidate($lei->{lse}->git,
                                                 $lei->{mset_opt}->{qstr});