From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] searchidx: preserve umask when starting/committing transactions
Date: Tue, 1 May 2018 01:51:41 +0000 [thread overview]
Message-ID: <20180501015141.9932-1-e@80x24.org> (raw)
Xapian will replace files upon committing, so non-parallel
V2Writable users need to have umask preserved this way.
---
lib/PublicInbox/SearchIdx.pm | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index aeb363e..74f9267 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -752,18 +752,23 @@ sub remote_remove {
sub begin_txn_lazy {
my ($self) = @_;
return if $self->{txn};
- my $xdb = $self->{xdb} || $self->_xdb_acquire;
- $self->{over}->begin_lazy if $self->{over};
- $xdb->begin_transaction;
- $self->{txn} = 1;
- $xdb;
+
+ $self->{-inbox}->with_umask(sub {
+ my $xdb = $self->{xdb} || $self->_xdb_acquire;
+ $self->{over}->begin_lazy if $self->{over};
+ $xdb->begin_transaction;
+ $self->{txn} = 1;
+ $xdb;
+ });
}
sub commit_txn_lazy {
my ($self) = @_;
delete $self->{txn} or return;
- $self->{xdb}->commit_transaction;
- $self->{over}->commit_lazy if $self->{over};
+ $self->{-inbox}->with_umask(sub {
+ $self->{xdb}->commit_transaction;
+ $self->{over}->commit_lazy if $self->{over};
+ });
}
sub worker_done {
--
EW
reply other threads:[~2018-05-01 1:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180501015141.9932-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).