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 6cc86d5d..5cea3706 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(<<EOM);
+DBD::SQLite version is v$DBD::SQLite::sqlite_version, need >= v3.8.3 for 
--jobs > 1
+EOM
        $opt->{jobs} = '1,1';
        undef;
 }

Reply via email to