Re: [PATCH 1/3] read-cache: use shared perms when writing shared index
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jun 23, 2017, 15:14 UTC
- Message-ID
- <CAP8UFD0OrPW+CUiXHBCXjumG=VOkpjnQFe09=UT9W0ULXE=X=g@mail.gmail.com>
- In-Reply-To
- <xmqq8tkjkdgl.fsf@gitster.mtv.corp.google.com>
On Thu, Jun 22, 2017 at 9:51 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
Show 15 quoted lines
>> Let's fix that by using create_tempfile() instead of mks_tempfile()
>> to create the shared index file.
>>
>> ...
>> - fd = mks_tempfile(&temporary_sharedindex, git_path("sharedindex_XXXXXX"));
>> + fd = create_tempfile(&temporary_sharedindex, git_path("sharedindex_XXXXXX"));
>
> So we used to create a temporary file that made sure its name is
> unique but now we create sharedindex_XXXXXX with 6 X's literally
> at the end?
>
> Doesn't mks_tempfile() family include a variant where you can give
> custom mode? Better yet, perhaps you can call adjust_shared_perm()
> on the path _after_ seeing that mks_tempfile() succeeds (you can ask
> get_tempfile_path() which path to adjust, I presume)?Yeah, adjust_shared_perm() is called after mks_tempfile() succeeds, in the next version.