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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux