]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
XapHelper.pm: fix QP_FLAGS initialization
authorEric Wong <e@80x24.org>
Thu, 6 Mar 2025 20:34:42 +0000 (20:34 +0000)
committerEric Wong <e@80x24.org>
Fri, 7 Mar 2025 19:23:17 +0000 (19:23 +0000)
We can't use $PublicInbox::Search::QP_FLAGS until after
load_xapian is called.  Failure to set the correct query parser
flags was causing failures in
`PI_NO_CXX=1 TEST_DAEMON_XH=-X0 prove -bw t/imapd.t'
since phrase parsing was broken with the Perl bindings
XapHelper implementation.

Now, the `check-xh0' and `check-xh1' targets both pass with
PI_NO_CXX=1 set to disable the C++ xap_helper.

Fixes: fa6a7919 (xap_helper: enable FLAG_PURE_NOT in external process, 2025-02-23)
lib/PublicInbox/XapHelper.pm

index 8f3e7e848a2dcd5b86ebe181fcc3330a3039dd68..54e2c174b7e4b80129affa10d83a6ffb8ac7b890 100644 (file)
@@ -20,7 +20,7 @@ use Carp qw(croak);
 my $X = \%PublicInbox::Search::X;
 our (%SRCH, %WORKERS, $nworker, $workerset, $in, $SHARD_NFD, $MY_FD_MAX);
 our $stderr = \*STDERR;
-my $QP_FLAGS = $PublicInbox::Search::QP_FLAGS;
+my $QP_FLAGS;
 
 sub cmd_test_inspect {
        my ($req) = @_;
@@ -338,6 +338,8 @@ sub start (@) {
 
        local (%SRCH, %WORKERS, $SHARD_NFD, $MY_FD_MAX);
        PublicInbox::Search::load_xapian();
+       $QP_FLAGS = $PublicInbox::Search::QP_FLAGS |
+               PublicInbox::Search::FLAG_PURE_NOT();
        $GLP->getoptionsfromarray(\@argv, my $opt = { j => 1 }, 'j=i') or
                die 'bad args';
        local $workerset = POSIX::SigSet->new;
@@ -349,7 +351,6 @@ sub start (@) {
                die "E: unable to get RLIMIT_NOFILE: $!";
        warn "W: RLIMIT_NOFILE=$MY_FD_MAX too low\n" if $MY_FD_MAX < 72;
        $MY_FD_MAX -= 64;
-       $QP_FLAGS |= PublicInbox::Search::FLAG_PURE_NOT();
 
        local $nworker = $opt->{j};
        return recv_loop() if $nworker == 0;