From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id A07D71F953 for ; Mon, 10 Jan 2022 19:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243478AbiAJTOn (ORCPT ); Mon, 10 Jan 2022 14:14:43 -0500 Received: from pb-smtp2.pobox.com ([64.147.108.71]:60084 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232564AbiAJTOn (ORCPT ); Mon, 10 Jan 2022 14:14:43 -0500 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 47B3D1022E1; Mon, 10 Jan 2022 14:14:42 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=N+HbWx8AbbhEMtDB8zMnaO7gPQJ+91AuTJ8CNZ Lrrgo=; b=JdA8MXvPGiT2zyIsvS/EgZeT+3AKltJL0AlwEib2DRl6Wr38kNEhMO tW48s75UNCZd1gJ0P9yW7V1DcjjaGgtKr9AVpg9TkHsRwlGZ5shHw305iFlNAeIS EWz/4Aomw2T7XNVAapCgD0zipdE5r5aUApZbsa+bpbzESmr0JYk1M= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 3ECEB1022E0; Mon, 10 Jan 2022 14:14:42 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 936421022DF; Mon, 10 Jan 2022 14:14:41 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: Han-Wen Nienhuys Cc: Han-Wen Nienhuys via GitGitGadget , git@vger.kernel.org, Han-Wen Nienhuys Subject: Re: [PATCH 3/3] reftable: support preset file mode for writing References: Date: Mon, 10 Jan 2022 11:14:40 -0800 In-Reply-To: (Han-Wen Nienhuys's message of "Mon, 10 Jan 2022 20:01:54 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 9007125C-7249-11EC-8D46-CB998F0A682E-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Han-Wen Nienhuys writes: > On Fri, Dec 24, 2021 at 5:46 AM Junio C Hamano wrote: >> > if (add->lock_file_fd < 0) { >> > if (errno == EEXIST) { >> > err = REFTABLE_LOCK_ERROR; >> > @@ -478,6 +478,13 @@ static int reftable_stack_init_addition(struct reftable_addition *add, >> > } >> > goto done; >> > } >> > + if (st->config.default_permissions) { >> > + if (chmod(add->lock_file_name.buf, st->config.default_permissions) < 0) { >> > + err = REFTABLE_IO_ERROR; >> > + goto done; >> >> This part does not exactly make sense, though. > > why? Explained in the part that follows that statement in the message you are responding to. > I read over the adjust_shared_perm function for a bit, but I'm puzzled > why its complexity is necessary. It seems to do something with X-bits, > maybe for directories, but that doesn't apply here as we're only > handling files? We are propagating executable bit, which affects both directories and files. > We also only write new files, so we never have to look at the existing > mode of a file. It is mostly about defeating the umask of whoever is esecuting "git".