🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1192

Re: [RFC/PATCH] config: honor file permission bits

#1192
From: "brian m. carlson"
Date: Thu, 22 Oct 2026 21:08
61 lines
11447 bytes
--Ng5psN6Kn2xcPgeM
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2026-10-22 at 20:59:57, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>=20
> > Because our updates to an existing file almost never makes
> > modifications in place, and instead create a new "lockfile",
> > propagate the permission bits from the original, copy the contents
> > from the original file while tweaking the contents as needed, and
> > then finally rename the lockfile to replace the original file, you
> > cannot "protect" your .global configuration file from accidental
> > clobbering by doing something like this:
> >
> > 	$ chmod a-w $HOME/.gitconfig
> >
> > Of course, if you make your $HOME directory unwritable, it may
> > protect your .gitconfig from getting updated, but that goes totally
> > against the intuition and is not how you would protect a regular
> > file from getting overwritten.
> >
> > Teach the configuration file writing machinery to inspect the
> > permission bits of the original with access(2) and refrain from
> > doing the usual "write a lockfile and replace the original with it"
> > dance ourselves when we shouldn't be able to write it.
> >
> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
> > ---
> >  config.c          | 22 ++++++++++++++++++++++
> >  t/t1300-config.sh | 30 ++++++++++++++++++++++++++++++
> >  2 files changed, 52 insertions(+)
>=20
> Hmph, no responses to this RFC.  I somehow find it hard to believe
> that I was the only person who got annoyed by this behaviour [*].

Sorry, I looked but forgot to respond.  It seems sensible to me.

I don't personally make that file read-only, so it doesn't affect me at
all; instead, I just overwrite it with my personal configuration every
time I deploy my dotfiles.  I still think it's a reasonable thing to do
to help those who need it, though.
--=20
brian m. carlson (they/them)
Toronto, Ontario, CA

--Ng5psN6Kn2xcPgeM
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

wr0EABYKAG8Fgmraez4JEHwMSWKIh6KBRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
LnNlcXVvaWEtcGdwLm9yZ1uD6T7PD6J/uZMcfj4RYf/1WuIPuele/Wy4Q2klWWQT
FiEECCzmip28ZfuD0cORfAxJYoiHooEAAOpyAQCEaT0EEM88uz8bMrYVv+Zq7/x1
WOUDIBZd0gfJmz/ulQEAsA9WYzKzfNRlHhKZy1U8C3BO4vrsPP/FTMDpYhTSYg8=
=MHB5
-----END PGP SIGNATURE-----

--Ng5psN6Kn2xcPgeM--
Technical Details
Message-ID: <atp7Pvtp1rdL8Uj_@fruit.crustytoothpaste.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72900-linux-kernel-git=dewy.ru
References: <xmqqbj8p7okv.fsf@gitster.g> <xmqqpkx1e9iq.fsf@gitster.g>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72900-linux-kernel-git=dewy.ru
From: sandals@crustytoothpaste.net ("brian m. carlson")
Newsgroups: linux.kernel.git
Subject: Re: [RFC/PATCH] config: honor file permission bits
Date: Thu, 22 Oct 2026 21:08:15 +0000
Organization: Usenet Network
Message-ID: <atp7Pvtp1rdL8Uj_@fruit.crustytoothpaste.net>
References: <xmqqbj8p7okv.fsf@gitster.g>
 <xmqqpkx1e9iq.fsf@gitster.g>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="Ng5psN6Kn2xcPgeM"
Injection-Info: usenet.network;
	logging-data="333920"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:d5qHbS5BlfJXoas5/r3RCeCIWrg= sha256:7wIS86PmGN/RcrDFTkPGLOTdqA3DP2VBn/9WNIFtr6A=
	sha1:PCBJAO9ejFaDgmhMhhcJU4ynRYA= sha256:FuEZGz+8gpCX5Rg5z+ZKm9EsldXdE5CgSuX+YWSznM8=
Content-Disposition: inline
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C30DF111159; Fri, 23 Oct 2026 00:10:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (3072-bit key)
	header.d=crustytoothpaste.net
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id OmSXk6v7p_Eh;
	Fri, 23 Oct 2026 00:10:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-72900-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=crustytoothpaste.net
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 8960711130A; Fri, 23 Oct 2026 00:09:51 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id E3DE138F77; Thu, 22 Oct 2026 21:08:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792703299;
	b=nUGsBRtIHl6VwJyX8Mdtg1EdVP0W3mylNEpvAKkH1WWQXGmPO/B3NOTiJ8ofXxZVsNCp
	 j+Vw9caMHf8XCfCFwQQ/irXEacjVbYqvOojRwpCwW8WAAq6+PxyryjBdJSeiGAHHRp3/9
	 Jg4sSSRxclYP7WU1JA9vLr63V+U8K6O9xW+5KX7i7uJANLEkgl09f8GFjOLjzsuYSyLb4
	 /fKTjB6JqVBqnoG5OiTwwD5NrBcs7bP9GEZOzNTg8q2D2pfkQ5wiFUJtgU+mDeEAcZQbl
	 vrDwIicSMM/y6hUOcVVHU13vJ7eJuJ1ogvVO7qyfKRxZ1DsGY4Qo9nnGnj1Z1RwilDA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792703299;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To:User-Agent;
	bh=SaF6Dvdu/zijH70cIGqCfIFXuDcrQ9tUjTTiUCW9fLI=;
	b=Tzl7V36vjZm7D2LLFSxRLl2V7hL30MXiRM8C5kgT0MmoN7BSdD5xKx482Wd41HLRaL1y
	 1QAQEIiUSY36ZA9B+X/VDo7SI3Ktor2q5p72fWM+3AgVnwphNSR9LljUl5/agT9QSO/L/
	 2a2bS7/18IE8kuRQFi7wd88TigyjeIrXANvpSPp0SZhQkyPFKcKedjZNWeSyPk/GohTbi
	 EN150u+UgwjFK9+dUDF34fjpB8lXKzLEnXuBsOVl0o319TC6hCw9egdrE7F1go3xsO8aW
	 BKdg0Bv+Hcvtw6MC7/Simwm1qC9T9W4hEBwViDp5oz8ezC8CA+Sp5OwK5bgmDqwHeug==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=ds43KF6F;
	dmarc=none header.from=crustytoothpaste.net;
	spf=pass smtp.mailfrom=crustytoothpaste.net;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B9F7E606A322;
	Thu, 22 Oct 2026 21:08:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (3072-bit key, unprotected) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=ds43KF6F
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=172.105.7.114
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792703298;
	b=GJfJB+InyCwgRArFf4BPIzV9u5Qf0XFKs0D6/LPhp2BIHqMXjAAsQ0EOASMymDn7XXtJ
	 LFB8YnGK4wCtllQe6KUKqEcziEJRfcRGOryK1uR6hgGMBicNfRZAOM9nWy0A4Kvz6LOmw
	 l48A5f0oTPzKFy1QLhoaoM0saa2FaQ1F8byXKmMuD736dCb+5wefqNCOo2clg64Lk85Y8
	 t6TfsF7SDn+LQmtZsvSwDFj9VqXQS47XOYX+8wzLc+j/j6hU3Hn3OuVAYsMtrm3OUHOKE
	 1WAPx3SBP2PTplvAcTQ+OkvG5WgbiW2+GLOHc6mgp5Va44Iu0i7CsfD9jFAR0Rcpfag==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792703298;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To:User-Agent;
	bh=SaF6Dvdu/zijH70cIGqCfIFXuDcrQ9tUjTTiUCW9fLI=;
	b=XJIGLGkznmVFhEwLCyELHHVNUgC59X1hGomxFaiCMN6E1lnq/jaF9hnwqz8ORmpCb6zK
	 IFKKOQClrUEa4qFQYDt8flV/fBb1N5UPv1xgw5flrOsPsWAHJBy53M/zYtxmgJksEmQG3
	 2fbkk86Kpr7+OmwFhfluC+1ujwPwRvpd/7deeM1myrjF7pos0ndTsHmuEn/9k/9TXaOLH
	 E6W+yUgNSH79zP9Qww3RNOZQ5uoTpzJFOHMIxbtFbIuOPG/NLh5UTwzcFg5wl8L7yNdK2
	 xM+6LItMV4H4m3Z7rhpDe9fjDqP2tzBQgDQCQClaKIt4+9olmRXpAsiS32/5dbUiZIQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=crustytoothpaste.net;
	spf=pass smtp.mailfrom=crustytoothpaste.net;
	dkim=pass header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=ds43KF6F;
	arc=none smtp.remote-ip=172.105.7.114
X-Received: from complex.crustytoothpaste.net (complex.crustytoothpaste.net [172.105.7.114])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFF52606A31A
	for <git@vger.kernel.org>; Thu, 22 Oct 2026 21:08:17 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFF52606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=crustytoothpaste.net
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crustytoothpaste.net
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net;
	s=default; t=1792703296;
	bh=gUDEzC5BdqEDOD1BPWGiJtyaumjHbiimsBiTGQ61dPg=;
	h=Date:From:To:Cc:Subject:References:Content-Type:
	 Content-Disposition:In-Reply-To:From:Reply-To:Subject:Date:To:CC:
	 Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To:References:
	 Content-Type:Content-Disposition;
	b=ds43KF6FAZzVeUl0oa4QNlnZs/LWRlLeCQo7/J9Ga3OucJHTreQL++VqsyqyslqGJ
	 8oxwDbezuVtlmf9hCrNW/5dFF7DPvWK9CMgCE3qS1I5LPcLSCkHYrdDztXBrmr5dkZ
	 wws8LYkYsi1nvP9cp4LImhybFStctOfv/g/vF9TqPyU6yhdmIlFj3InNY5vtMf+ysG
	 gR1qtGwUtQbZSwkZLkYtnj/kpdEzWrKfEUYtJM4JKVru1z+xVpClPWf22+CuEy/1yI
	 yV5VyNQi4y9W1vYlwowr79dORqwoZJc+1H1Bl2m0CMmJ+fQiCjbih1nPt42xixzH2D
	 DOh14cLe0lhoadBymKVFiAyY33Z6/lRzSCLRGEAlsSOUe8jmSFN5AokZbQSNpTi2q0
	 X42xkCScq8bDzdfMbeYVtPEMH6MfF8l/jEZphPUwHZTqXjyR9SEvg/C0njx9DOlppL
	 2wbTE44+6fxyqlXFPUO7LJdz5r9LMwKgoctxND/whKAk4BPcZzT
X-Received: from fruit.crustytoothpaste.net (unknown [IPv6:2607:f2c0:f00f:f901:b44d:c6f6:4e4b:66bf])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by complex.crustytoothpaste.net (Postfix) with ESMTPSA id B6FAF2006B;
	Thu, 22 Oct 2026 21:08:16 +0000 (UTC)
X-Cc: git@vger.kernel.org
X-Mail-Followup-To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <xmqqpkx1e9iq.fsf@gitster.g>
X-User-Agent: Mutt/2.4.1 (2026-07-04)