git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] reftable: adjust permissions of compacted tables

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 24, 2024, 12:31 UTC
Message-ID
<cover.1706099090.git.ps@pks.im>
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
Next: Patrick Steinhardt
Message 1 of 9 in “reftable: adjust permissions of compacted tables”
  1. 0/2 reftable: adjust permissions of compacted tablesPatrick Steinhardt, Jan 24, 2024
  2. 1/2 reftable/stack: use fchmod(3P) to set permissionsPatrick Steinhardt, Jan 24, 2024
  3. 2/2 reftable/stack: adjust permissions of compacted tablesPatrick Steinhardt, Jan 24, 2024
  4. reftable/stack: adjust permissions of compacted tablesPatrick Steinhardt, Jan 24, 2024
  5. Karthik NayakJan 25, 2024
  6. Justin ToblerJan 25, 2024
  7. Patrick SteinhardtJan 26, 2024
  8. reftable/stack: adjust permissions of compacted tablesPatrick Steinhardt, Jan 26, 2024
  9. Justin ToblerJan 30, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.