From 2a353273079b2491cbceb20526d3c9dbf43d8f62 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 18 Apr 2018 23:27:44 +0000 Subject: ensure SQLite and Xapian files respect core.sharedRepository We can't have files with permissions inconsistent with what's in git objects. --- lib/PublicInbox/Over.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Over.pm') diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 07e54b64..30f2603f 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -15,7 +15,11 @@ use Compress::Zlib qw(uncompress); sub dbh_new { my ($self) = @_; my $ro = ref($self) eq 'PublicInbox::Over'; - my $dbh = DBI->connect("dbi:SQLite:dbname=$self->{filename}",'','', { + my $f = $self->{filename}; + if (!$ro && !-f $f) { # SQLite defaults mode to 0644, we want 0666 + open my $fh, '+>>', $f or die "failed to open $f: $!"; + } + my $dbh = DBI->connect("dbi:SQLite:dbname=$f",'','', { AutoCommit => 1, RaiseError => 1, PrintError => 0, -- cgit v1.2.3-24-ge0c7