From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id AF7251F42D for ; Wed, 30 May 2018 17:57:20 +0000 (UTC) Received: by mail-it0-x242.google.com with SMTP id e20-v6so24622027itc.1 for ; Wed, 30 May 2018 10:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oNvHBMaPEZv6ShtQ0esGqC2e2dvjOq3Hjg+wwfi5MSQ=; b=PWbBQbK+aneKyQSbz09xpgh+gvCdrqp3yQS2Rz3InndbNYisCDo/w1favR3sLkqbmZ ObyyWFFyagL+n/bA7tOnYsWcOUc4CMU+LyRgF1mGLFQwYQ29UNV3t2TiZCBZXi99qy6i tH5+8FKwZRpZAVVA+XCJxKdZnIGhn4gy1DNnU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oNvHBMaPEZv6ShtQ0esGqC2e2dvjOq3Hjg+wwfi5MSQ=; b=iFxXKNmPsZFI1836f+KfoAffzj+5tfO6O0BA3Ucv80RDV03K3cxR2uHKC4XFN5x41X iKQUJjznTtAPDrQDsKJMDvlRu7JSoAvlY4C2tggolmHSs9khewQJTyygYrprahylrbZN J3zAk7tDHx8zJsJl9+Mc55E22OgmrsENVu6fjL46e7F1nBUfUe+aV3vYsjUafpsGfxJs K6z9wcdn4AVs80nceuA0R2JvvHwVUWBaZz/VQYVqiDGYHiNasytMIXKWzzhmamMA8l+8 vC7FzFpyeZk365eoqX9UJGNIShPeWGHX8gEqa945iXCwra4gA6KKgPTfElogGJOWjMBf UHog== X-Gm-Message-State: APt69E15gGm/uCSZsLDq239e626fLQAGlxheKz7Wm1lQ0QFUA0bGm3L3 qPTFlXNgJamCpIVA1eKT0EF0TA== X-Google-Smtp-Source: ADUXVKK0sbg088YtlK+JASjZu/T7bifFIDVtwGc//MvZiX/D4vH6+9EoVV9PZ3D+xZv5f19Ue6DWyw== X-Received: by 2002:a24:154c:: with SMTP id 73-v6mr2720861itq.51.1527703039751; Wed, 30 May 2018 10:57:19 -0700 (PDT) Received: from chatter (ca2x.mullvad.net. [162.219.176.251]) by smtp.gmail.com with ESMTPSA id j63-v6sm9437018itb.2.2018.05.30.10.57.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 10:57:19 -0700 (PDT) Date: Wed, 30 May 2018 13:57:16 -0400 From: Konstantin Ryabitsev To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH] respect umask if core.sharedRepository is not set Message-ID: <20180530175716.GA14172@chatter> References: <38873789-ab42-65a1-20c9-12c30b171f4f@linuxfoundation.org> <20180530025448.GA29627@whir> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <20180530025448.GA29627@whir> User-Agent: Mutt/1.9.5 (2018-04-13) List-Id: On Wed, May 30, 2018 at 02:54:48AM +0000, Eric Wong wrote: >> For some reason, when public-inbox-mda reindexes the repository >> past-delivery, it creates some files as 0660, even though umask is >> specifically set to 0002: > >(sorry for the late reply, haven't been well) Eh, no worries! >Oops, I misread/misunderstood how git handles the >core.sharedRepository unset case :x > >The following should fix it: It does, thanks! -K > >------8<------ >Subject: [PATCH] respect umask if core.sharedRepository is not set > >This is consistent with git itself and the previous behavior >was a result of misunderstanding of how git interprets this. >And adjust tests slightly to match the new behavior. > >Reported-by: Konstantin Ryabitsev > <38873789-ab42-65a1-20c9-12c30b171f4f@linuxfoundation.org> >--- > lib/PublicInbox/InboxWritable.pm | 2 +- > t/search.t | 5 +++-- > t/v2writable.t | 1 + > 3 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm >index 5c11a36..9b0cdfd 100644 >--- a/lib/PublicInbox/InboxWritable.pm >+++ b/lib/PublicInbox/InboxWritable.pm >@@ -175,7 +175,7 @@ sub _read_git_config_perm { > sub _git_config_perm { > my $self = shift; > my $perm = scalar @_ ? $_[0] : _read_git_config_perm($self); >- return PERM_GROUP if (!defined($perm) || $perm eq ''); >+ return PERM_UMASK if (!defined($perm) || $perm eq ''); > return PERM_UMASK if ($perm eq 'umask'); > return PERM_GROUP if ($perm eq 'group'); > if ($perm =~ /\A(?:all|world|everybody)\z/) { >diff --git a/t/search.t b/t/search.t >index 9a90fd5..c971fe3 100644 >--- a/t/search.t >+++ b/t/search.t >@@ -11,7 +11,7 @@ my $tmpdir = tempdir('pi-search-XXXXXX', TMPDIR => 1, CLEANUP => 1); > my $git_dir = "$tmpdir/a.git"; > my ($root_id, $last_id); > >-is(0, system(qw(git init -q --bare), $git_dir), "git init (main)"); >+is(0, system(qw(git init --shared -q --bare), $git_dir), "git init (main)"); > eval { PublicInbox::Search->new($git_dir) }; > ok($@, "exception raised on non-existent DB"); > >@@ -422,11 +422,12 @@ $ibx->with_umask(sub { > }); > > foreach my $f ("$git_dir/public-inbox/msgmap.sqlite3", >+ "$git_dir/public-inbox", > glob("$git_dir/public-inbox/xapian*/"), > glob("$git_dir/public-inbox/xapian*/*")) { > my @st = stat($f); > my ($bn) = (split(m!/!, $f))[-1]; >- is($st[2] & 07777, -f _ ? 0660 : 0770, >+ is($st[2] & 07777, -f _ ? 0660 : 02770, > "sharedRepository respected for $bn"); > } > >diff --git a/t/v2writable.t b/t/v2writable.t >index 00b08e0..9e3bb75 100644 >--- a/t/v2writable.t >+++ b/t/v2writable.t >@@ -11,6 +11,7 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { > plan skip_all => "$mod missing for nntpd.t" if $@; > } > use_ok 'PublicInbox::V2Writable'; >+umask 007; > my $mainrepo = tempdir('pi-v2writable-XXXXXX', TMPDIR => 1, CLEANUP => 1); > my $ibx = { > mainrepo => $mainrepo, >-- >EW