Web lists-archives.com

Re: [PATCH v2] read-cache: write all indexes with the same permissions




On Fri, Nov 16, 2018 at 8:10 PM Christian Couder
<christian.couder@xxxxxxxxx> wrote:
>
> On Fri, Nov 16, 2018 at 7:03 PM Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> >
> > On Fri, Nov 16, 2018 at 6:31 PM Christian Couder
> > <christian.couder@xxxxxxxxx> wrote:
> > > diff --git a/read-cache.c b/read-cache.c
> > > index 8c924506dd..ea80600bff 100644
> > > --- a/read-cache.c
> > > +++ b/read-cache.c
> > > @@ -3165,7 +3165,8 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
> > >                 struct tempfile *temp;
> > >                 int saved_errno;
> > >
> > > -               temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
> > > +               /* Same permissions as the main .git/index file */
> >
> > If the permission is already correct from the beginning (of this temp
> > file), should df801f3f9f be reverted since we don't need to adjust
> > permission anymore?
>
> df801f3f9f (read-cache: use shared perms when writing shared index,
> 2017-06-25) was fixing the bug that permissions of the shared index
> file did not take into account the shared permissions (which are about
> core.sharedRepository; "shared" has a different meaning in "shared
> index file" and in "shared permissions").
>
> This fix only changes permissions before the shared permissions are
> taken into account (so before adjust_shared_perm() is called).
>
> > Or does $GIT_DIR/index go through the same adjust_shared_perm() anyway
> > in the end, which means df801f3f9f must stay?
>
> Yeah, $GIT_DIR/index goes through adjust_shared_perm() too because
> create_tempfile() calls adjust_shared_perm(). So indeed df801f3f9f
> must stay.

Ah thanks. By the time I got to this part

> Let's instead make the two consistent by using mks_tempfile_sm() and
> passing 0666 in its `mode` argument.

went look at that function and back, I forgot about the paragraph above it.
-- 
Duy