about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-28 22:11:32 +0000
committerEric Wong <e@yhbt.net>2020-07-29 11:32:50 +0000
commita3391407c960e4bbd825a34b87d053de6ef3767a (patch)
tree11026260b9886ff741cb416820e44f84a7c3c258 /lib
parent81baaec0a1ebb05b2b31f084a7b18fd7bedb5d4a (diff)
downloadpublic-inbox-a3391407c960e4bbd825a34b87d053de6ef3767a.tar.gz
v2writable: use {inboxdir} for msgmap->tmp_clone
Otherwise, a user is more likely to remove the msgmap-XXXXXXXX
SQLite file from $TMPDIR and cause SQLite to error out.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Msgmap.pm4
-rw-r--r--lib/PublicInbox/V2Writable.pm3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index 839ddf7c..51b6a68c 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -48,8 +48,8 @@ sub new_file {
 
 # used to keep track of used numeric mappings for v2 reindex
 sub tmp_clone {
-        my ($self) = @_;
-        my ($fh, $fn) = tempfile('msgmap-XXXXXXXX', EXLOCK => 0, TMPDIR => 1);
+        my ($self, $dir) = @_;
+        my ($fh, $fn) = tempfile('msgmap-XXXXXXXX', EXLOCK => 0, DIR => $dir);
         my $tmp;
         if ($self->{dbh}->can('sqlite_backup_to_dbh')) {
                 $tmp = ref($self)->new_file($fn, 2);
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 6908bd2e..e071bc1e 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -1225,7 +1225,8 @@ sub index_sync {
                 # only for batch performance.
                 $self->{mm}->{dbh}->rollback;
                 $self->{mm}->{dbh}->begin_work;
-                $sync->{mm_tmp} = $self->{mm}->tmp_clone;
+                $sync->{mm_tmp} =
+                        $self->{mm}->tmp_clone($self->{ibx}->{inboxdir});
         }
         if ($sync->{index_max_size} = $self->{ibx}->{index_max_size}) {
                 $sync->{index_oid} = \&index_oid;