From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=172.105.7.114 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796251386; b=xgVe9qHZY9EDx20fmFhftHRrrL2J7qeoNIPYMb54ReXqYZyK4UKbEEjw/PjkYDoh+ulr dbKzfVRQyxhSQl0mJuCgT4PPdIv01Q029qiGsyExpO3g0hJKAl/FMovKHBsNJZ8jHifp1 7tDFSvr69UvLJAmqdgQT1dy2y8vuAJ/vzr8Z6ows0YKgl/138eERi0mLg6Nbxn9DMb8ss 64bQ2UyGw0QkJ4fKzjoI+vELR5+8a6BdWqRF/rOI6RM9mypqmHdUhGtMkd9lICIRJ8n89 D5Wl7t4rGjQGvBMzPOFu9vw4zkSXmRWsGU6zZzzEmahVce0vR4LqS805K4GZNiu0W4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796251386; 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=Ex1t7D/ih09s/K5PvyAkj7fX3LbQ+vtnOWYcTsv69tw=; b=Tc9j+NFPdVcVm8i3aca0pepa9oEqon+nJZ15aLEvnwFpFipdc9KipNtjPS1Pkf1o24Zs avq+PZmCOMQ5mmBXAL27mE2rfAKWem4A6iEBFchK7QavQIKfK/FKANzm+P1M24PRsUAtP iEqwaeL2kkiK0+yUHoUmv+ofFd0oqTBzN3n5HI5bwgoVzWovr8QOdIp5Fwpurm34e23rJ op5ToxcYQFwuwTIbNPpBKnfmBFv+eoLAWc2GlQYlUmzPr4gywWK9F9Lb0IZTfW6qwZW4z 9ZdFKJ5bqaq2Aq6dzaYd/R3eNK28/mT82yG/7xrSFfqtQMl3g93rsvrzn+Avv8jvKZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass 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=AvTbVp91; arc=none smtp.remote-ip=172.105.7.114 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 15D5E606A322 for ; Wed, 2 Dec 2026 22:43:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15D5E606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crustytoothpaste.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crustytoothpaste.net 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=AvTbVp91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1796251384; bh=Wi2ge4KlE/zO/OAyM2Ef2mkz5/zFihnWNyqSat5Mt9s=; 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=AvTbVp91QkA+cat+z7BREsoxWwcfX8MCCK1i23/VG3kHhqc+HoRINQtrIRwfiugUt w6bby/DYcT3lR9JJEGie8MV/UFgozYMGM4vxBH8+34Lj93HIqrJceUM66VoPuKiPx1 GAZEtm1/ZFTrd17Jq9ZFHZatwYQedcrTbp7JK/EhUXYif3bVXqtGA7+Owv6e8g2ziV AI0tSMG6wDChwMWPT7Q1l6WAOO6HRaARths7zdAHkeN0PXY6mWzBNeQgTqeYxpmwaI sz5GISuu6N36YwKKiheduakmcmL6Wq9x2m5roo2shwOrMbCQahnJtVTqJb2CQ+tak1 Rt9YB+bMfTVkMVAi2upqEm0cTvUISSXPSiE6jRy1JylGaiiJ36gz/ibWFgLw3spg5Z R2lm+arj7bbltOfmq3NnBXvQOLGv5pxgZDutFsd+5qYoJTlU+ooAa1kuQZheEMzur9 1QzxPiLk1EarwZ4GWRGjFqOx/Sb1dd7wRZfC32xRz3DkdNXv/vL Received: from fruit.crustytoothpaste.net (unknown [IPv6:2607:f2c0:f00f:f901:1812:8cd:cccd:6e85]) (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 B6BD2200AF; Wed, 2 Dec 2026 22:43:04 +0000 (UTC) Date: Wed, 2 Dec 2026 22:43:03 +0000 From: "brian m. carlson" To: Jessica Clarke Cc: git@vger.kernel.org Subject: Re: Shallow clones: ctime shouldn't be used on FreeBSD with UFS + soft-updates Message-ID: Mail-Followup-To: "brian m. carlson" , Jessica Clarke , git@vger.kernel.org References: <41F956FA-64BC-4F68-8619-2E8B9889C26F@jrtc27.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jUYUfA9RaYELblgA" Content-Disposition: inline In-Reply-To: <41F956FA-64BC-4F68-8619-2E8B9889C26F@jrtc27.com> User-Agent: Mutt/2.4.1 (2026-07-04) --jUYUfA9RaYELblgA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2026-12-02 at 18:10:33, Jessica Clarke wrote: > Hi, > Git uses ctime in various ways, but one of them is to check that the > shallow file has not changed since the last time it was read during a > shallow clone. In the case of the shallow file, it comes into being by > being renamed from shallow.lock, and is then immediately stat=E2=80=99ed = to > give the before value. However, FreeBSD=E2=80=99s UFS soft-updates > implementation has slightly surprising semantics for unlink (and > internally uses link + unlink to implement rename): it will update > ctime at the point of unlink (and thus rename), but will *also* later > update it once its asynchronous soft-updates work is finished (see [1] > that explains this latter update, and introduces the former). This > means that, if Git is keying off ctime to determine whether shallow has > changed, it can race with this soft-updates code and potentially sample > either side of it, seeing the value change solely due to internal > bookkeeping work in the filesystem. I'm not sure this is technically POSIX compliant. rename(2) is documented to update ctime, so that's okay. But it says this: An implementation may update timestamps that are marked for update immediately, or it may update such timestamps periodically. However, it doesn't say you can update them twice for the same operation. It would be allowed to update them _only_ at the soft-update point or only immediately, but I don't think twice is allowed. We do try to accommodate systems that don't fully comply with POSIX, but it is likely that Git is not the only tool that could be negatively affected here. > As a result, I see git submodule update --depth=3D1 some/path > sporadically fail on a FreeBSD 15.0-RELEASE-p11 (but as far as I know > not limited to this version) builder we have, with: >=20 > > fatal: shallow file has changed since we read it >=20 > I have set core.trustctime to false in the build user=E2=80=99s ~/.gitcon= fig as > a workaround. However, I imagine that other uses for ctime might be > tolerant of this behaviour, just leading to minor inefficiency, and so > having this default to false on FreeBSD might be a bit too broad a fix? > I don=E2=80=99t take a strong view on what the right fix is, but would > appreciate it if Git could by default on FreeBSD not use ctime to > determine whether the shallow file has changed. The function that's called is match_stat_data, so I'm pretty sure it applies to all stat data, including the index, so my guess is pretty much nothing is going to be tolerant of this behaviour without core.trustctime. Functions updating the index will probably just re-read the data and be correct, if inefficient, so you may not have noticed anything odd in that regard. My suggestion would be that the FreeBSD Git packages set this in /etc/gitconfig if this is appropriate there. I don't use FreeBSD except to test, so I can't really say what the appropriate setting there is. For instance, UFS without soft-updates might be fine, or ZFS might not have this problem, and those users might not want to incur the potential negative consequences in this case. I think the FreeBSD packagers are best suited to make an appropriate decision and that's consistent with what other packagers do here[0]. They can also generate that configuration file on installation to set operations based on what file systems are in use in a way that would be hard for us to confidently and correctly do. I also don't believe we have OS-specific defaults for config options; usually those are global unless the platform is completely incapable of something (e.g., symlinks) and we can easily detect that fact at repo creation time, which I don't think we can do here in a generic way. (For instance, statfs(2) is notoriously unportable.) This config option exists, as do many others, to gracefully handle infelicities in system implementation, including poorly behaved file systems, so using it is the right solution here. [0] For instance, Apple and Homebrew ship `credential.helper=3Dosxkeychain` in the system config, and Git for Windows also sets a variety of config options suitable for that platform. --=20 brian m. carlson (they/them) Toronto, Ontario, CA Speaking for myself only --jUYUfA9RaYELblgA Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- wr0EABYKAG8FgmsQnvYJEHwMSWKIh6KBRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z LnNlcXVvaWEtcGdwLm9yZ5KUj4L/eXtXrzuRi4adWob1cVFYKcuzqCLJEuqnrUZF FiEECCzmip28ZfuD0cORfAxJYoiHooEAAII3AQCvU69dwE1YQZW2lzDIA0FY+tpu SSkkqmhRb7UV1isYNAEA6gMsfyr6P9qxq6K+6Oq31kRTJ+oaXGS3nt1MKw30BAQ= =DrDa -----END PGP SIGNATURE----- --jUYUfA9RaYELblgA--