From 3b8315e371c322ff59b31b36b14d9b7568e708fe Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 1 Oct 2023 09:54:26 +0000 Subject: [PATCH] overidx: fix version comparison We can't use $DBD::SQLite::sqlite_version_number with older versions of DBD::SQLite. Thus we need to treat the $DBD::SQLite::sqlite_version string (e.g. "3.8.3", not v-string) and convert it to a v-string with eval for version comparisons to determine if we can fork multiple children when using SQLite. Fixes: fa04201baae9 ("lei: force --jobs=1,1 for SQLite < 3.8.3") --- lib/PublicInbox/OverIdx.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 6cc86d5d0..5cea37068 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -671,13 +671,14 @@ sub vivify_xvmd { } sub fork_ok { - return 1 if $DBD::SQLite::sqlite_version >= 3008003; + state $fork_ok = eval("v$DBD::SQLite::sqlite_version") ge v3.8.3; + return 1 if $fork_ok; my ($opt) = @_; my @j = split(/,/, $opt->{jobs} // ''); state $warned; - grep { $_ > 1 } @j and $warned //= warn('DBD::SQLite version is ', - $DBD::SQLite::sqlite_version, - ", need >= 3008003 (3.8.3) for --jobs > 1\n"); + grep { $_ > 1 } @j and $warned //= warn(<= v3.8.3 for --jobs > 1 +EOM $opt->{jobs} = '1,1'; undef; } -- 2.47.2