diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-05 09:34:12 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-05 10:27:13 +0000 |
commit | 5038857ec7663674c782affa11d5f33620107555 (patch) | |
tree | 1ea40cf5c0faecdd3d2eeffbf37feb335377f605 /script | |
parent | 56489ee40e44255f2f9a00cd608bc366d2586306 (diff) | |
download | public-inbox-5038857ec7663674c782affa11d5f33620107555.tar.gz |
Lets not scare users when they encounter files that are supposed to be there. Then, preserve the journal and pipe.lock, even if they're supposedly unused due to us holding the inbox-wide lock.
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-compact | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact index e6977165..b8aaa4bd 100755 --- a/script/public-inbox-compact +++ b/script/public-inbox-compact @@ -35,8 +35,16 @@ $ibx->umask_prepare; sub commit_changes ($$$) { my ($im, $old, $new) = @_; my @st = stat($old) or die "failed to stat($old): $!\n"; + + for my $suf (qw(.pipe.lock -journal)) { + my $orig = "$old/over.sqlite3$suf"; + link($orig, "$new/over.sqlite3$suf") and next; + next if $!{ENOENT}; + die "failed to link $orig => $new/over.sqlite3$suf: $!\n"; + } link("$old/over.sqlite3", "$new/over.sqlite3") or die "failed to link {$old => $new}/over.sqlite3: $!\n"; + rename($old, "$new/old") or die "rename $old => $new/old: $!\n"; chmod($st[2] & 07777, $new) or die "chmod $old: $!\n"; rename($new, $old) or die "rename $new => $old: $!\n"; @@ -58,6 +66,7 @@ if ($v == 2) { if ($dn =~ /\A\d+\z/) { push @parts, "$old/$dn"; } elsif ($dn eq '.' || $dn eq '..') { + } elsif ($dn =~ /\Aover\.sqlite3/) { } else { warn "W: skipping unknown Xapian DB: $old/$dn\n" } |