about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-04-24 10:23:30 +0000
committerEric Wong <e@80x24.org>2021-04-24 16:10:04 -0400
commit1c0dce28a8604b16488ea7416dcf1bddd66a5d42 (patch)
tree2ff3d81eba6b4ee1e2c9113763cb20bf0b4c782b /lib/PublicInbox
parentb6b86cfd238c170ea3e2c4d4179f06c7af139086 (diff)
downloadpublic-inbox-1c0dce28a8604b16488ea7416dcf1bddd66a5d42.tar.gz
This allows us to handle odd inboxes w/o a newsgroup configured
if they also make the strange choice of having backslashes in
their path name.  Also, ensure we use case-sensitive LIKE, since
case-insensitive FSes are not worth supporting.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index a17e7579..9d6b3b9d 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -336,9 +336,11 @@ sub eidx_gc {
         $self->idx_init($opt); # acquire lock via V2Writable::_idx_init
 
         my $dbh = $self->{oidx}->dbh;
+        $dbh->do('PRAGMA case_sensitive_like = ON'); # only place we use LIKE
         my $x3_doc = $dbh->prepare('SELECT docid FROM xref3 WHERE ibx_id = ?');
         my $ibx_ck = $dbh->prepare('SELECT ibx_id,eidx_key FROM inboxes');
-        my $lc_i = $dbh->prepare('SELECT key FROM eidx_meta WHERE key LIKE ?');
+        my $lc_i = $dbh->prepare(<<'');
+SELECT key FROM eidx_meta WHERE key LIKE ? ESCAPE ?
 
         $ibx_ck->execute;
         while (my ($ibx_id, $eidx_key) = $ibx_ck->fetchrow_array) {
@@ -354,8 +356,8 @@ DELETE FROM inboxes WHERE ibx_id = ?
 
                 # drop last_commit info
                 my $pat = $eidx_key;
-                $pat =~ s/([_%])/\\$1/g;
-                $lc_i->execute("lc-%:$pat//%");
+                $pat =~ s/([_%\\])/\\$1/g;
+                $lc_i->execute("lc-%:$pat//%", '\\');
                 while (my ($key) = $lc_i->fetchrow_array) {
                         next if $key !~ m!\Alc-v[1-9]+:\Q$eidx_key\E//!;
                         warn "I: removing $key\n";