All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 0/2] reftable: adjust permissions of compacted tables
Date: Wed, 24 Jan 2024 13:31:30 +0100	[thread overview]
Message-ID: <cover.1706099090.git.ps@pks.im> (raw)

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

Hi,

this small patch series fixes a bug in the reftable stack implementation
where the "default_permissions" write option is not honored for newly
written compacted tables. The effect is that the "core.sharedRepository"
config is ignored when performing compaction.

The series runs into two minor conflicts with jc/reftable-core-fsync
that can be fixed like follows. As this series has been merged to next
already I'd also be happy to rebase these patches on top of it. Please
let me know your preference.

Patrick

diff --cc reftable/stack.c
index 27cc586460,ab295341cc..0000000000
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@@ -633,13 -643,13 +643,13 @@@ int reftable_addition_add(struct reftab
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 -      if (add->stack->config.default_permissions) {
 -              if (chmod(temp_tab_file_name.buf, add->stack->config.default_permissions)) {
 -                      err = REFTABLE_IO_ERROR;
 -                      goto done;
 -              }
 +      if (add->stack->config.default_permissions &&
 +          fchmod(tab_fd, add->stack->config.default_permissions) < 0) {
 +              err = REFTABLE_IO_ERROR;
 +              goto done;
        }
 +
-       wr = reftable_new_writer(reftable_fd_write, &tab_fd,
+       wr = reftable_new_writer(reftable_fd_write, reftable_fd_flush, &tab_fd,
                                 &add->stack->config);
        err = write_table(wr, arg);
        if (err < 0)
@@@ -731,13 -741,7 +741,13 @@@ static int stack_compact_locked(struct
        strbuf_addstr(temp_tab, ".temp.XXXXXX");

        tab_fd = mkstemp(temp_tab->buf);
 +      if (st->config.default_permissions &&
 +          fchmod(tab_fd, st->config.default_permissions) < 0) {
 +              err = REFTABLE_IO_ERROR;
 +              goto done;
 +      }
 +
-       wr = reftable_new_writer(reftable_fd_write, &tab_fd, &st->config);
+       wr = reftable_new_writer(reftable_fd_write, reftable_fd_flush, &tab_fd, &st->config);

        err = stack_write_compact(st, wr, first, last, config);
        if (err < 0)

Patrick Steinhardt (2):
  reftable/stack: use fchmod(3P) to set permissions
  reftable/stack: adjust permissions of compacted tables

 reftable/stack.c      | 35 ++++++++++++++++++++---------------
 reftable/stack_test.c | 25 +++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 17 deletions(-)

-- 
2.43.GIT


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2024-01-24 12:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 12:31 Patrick Steinhardt [this message]
2024-01-24 12:31 ` [PATCH 1/2] reftable/stack: use fchmod(3P) to set permissions Patrick Steinhardt
2024-01-24 12:31 ` [PATCH 2/2] reftable/stack: adjust permissions of compacted tables Patrick Steinhardt
2024-01-24 12:53 ` [PATCH v2] " Patrick Steinhardt
2024-01-25 13:05   ` Karthik Nayak
2024-01-25 16:02   ` Justin Tobler
2024-01-26 10:05     ` Patrick Steinhardt
2024-01-26 10:09 ` [PATCH v3] " Patrick Steinhardt
2024-01-30 16:56   ` Justin Tobler

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1706099090.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.