Article View: linux.kernel.git
Article #4293Re: Shallow clones: ctime shouldn't be used on FreeBSD with UFS + soft-updates
From: "brian m. carlson"
Date: Wed, 02 Dec 2026 22:43
Date: Wed, 02 Dec 2026 22:43
103 lines
14035 bytes
14035 bytes
--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--
Technical Details
Message-ID:
<axCe9q1zRyMVMtO8@fruit.crustytoothpaste.net>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76930-linux-kernel-git=dewy.ruReferences:
<41F956FA-64BC-4F68-8619-2E8B9889C26F@jrtc27.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76930-linux-kernel-git=dewy.ru
From: sandals@crustytoothpaste.net ("brian m. carlson")
Newsgroups: linux.kernel.git
Subject: Re: Shallow clones: ctime shouldn't be used on FreeBSD with UFS +
soft-updates
Date: Wed, 2 Dec 2026 22:43:03 +0000
Organization: Usenet Network
Message-ID: <axCe9q1zRyMVMtO8@fruit.crustytoothpaste.net>
References: <41F956FA-64BC-4F68-8619-2E8B9889C26F@jrtc27.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="jUYUfA9RaYELblgA"
Injection-Info: usenet.network;
logging-data="2078524"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jU4ae9F1xKO7ZruzahXTaYrWR+4= sha256:s/tobT3A2hUtjyu3mSBMJjXNm+emEMk9A79YNDYX5jw=
sha1:B3pSpK9/GipleAA5R64sRqOHyuw= sha256:K4HZjD+QpJG8y2usUC1gbLJ9Lok65y7eT5kQXEaF5tY=
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 819A711775B; Thu, 3 Dec 2026 01:43:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 TPWlBgxUk79M;
Thu, 3 Dec 2026 01:43:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76930-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (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 0C71111773C; Thu, 3 Dec 2026 01:43:09 +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 9F4CF279D9; Wed, 2 Dec 2026 22:43:07 +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=1796251387;
b=PgzgNxhULoOGXDGGCwQ7KL+jlKavNcQFjoUFi5khYuh0rGAeOgUPCgiOQPbGTpKbIYCx
u3ZZMspcncH7JfsIPui/pT+3fKIkv/rwCMZwQUzutltQcwu3v5Gt+LmH9rcpDpyip5thh
yS2jQWfjh5MO5DyL3yRPRnG9BCwHGv90RaMuXZH63PyPTinOq4TSSU6EkK80yg3p35V8z
Mx8ftCSAMTFZBt4fHRByK5Q1vpD0sNSx5aSSGhh6JFyKD91Ure9AYaacwcZ+9U7LAhGI4
IgLBZ7tqpT55doZgiqNnQRF2M/yCn2gJFYio45wNG/jRQqnLhYgngf06UoCboJc//7w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796251387;
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=Ex1t7D/ih09s/K5PvyAkj7fX3LbQ+vtnOWYcTsv69tw=;
b=MTKEtNk0v7LyyZ0Qph/reeVyQHXCrWbhj4RKAuzal4+cn5o3SKXz9lvmmzI7Vb3Q/+j+
SUt6rIfzatUPw43QL8sCZPcKQjb0UHYITW3VSf7O4xya+KUcu9grRoOWN9rYlMrWqCsG7
KcMaqcHAIL3ybgXrl34VhsXtkOixMZt9aayOiWIaR5BqDTFH0joG5W5CWXVsHTSpFVVZb
lReB1UQPek74zZJJAKqZNk2fbjWOYFG3eltLzkurPhvspCVnDqfxzDj6ZPqBSEWPjG6G4
jXzlCh9pwrqfWTiVIJj/OveryTQI2Imo1OwZNrADLwA9XTXxLCyOHmzEhYkke0XExzw==
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=AvTbVp91;
dmarc=pass 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 72A51606A333;
Wed, 2 Dec 2026 22:43:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (3072-bit key) header.d=crustytoothpaste.net header.i=@crustytoothpaste.net header.a=rsa-sha256 header.s=default header.b=AvTbVp91
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=1796251386;
b=xgVe9qHZY9EDx20fmFhftHRrrL2J7qeoNIPYMb54ReXqYZyK4UKbEEjw/PjkYDoh+ulr
dbKzfVRQyxhSQl0mJuCgT4PPdIv01Q029qiGsyExpO3g0hJKAl/FMovKHBsNJZ8jHifp1
7tDFSvr69UvLJAmqdgQT1dy2y8vuAJ/vzr8Z6ows0YKgl/138eERi0mLg6Nbxn9DMb8ss
64bQ2UyGw0QkJ4fKzjoI+vELR5+8a6BdWqRF/rOI6RM9mypqmHdUhGtMkd9lICIRJ8n89
D5Wl7t4rGjQGvBMzPOFu9vw4zkSXmRWsGU6zZzzEmahVce0vR4LqS805K4GZNiu0W4w==
X-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==
X-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
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 15D5E606A322
for <git@vger.kernel.org>; Wed, 2 Dec 2026 22:43:05 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15D5E606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (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=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
X-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)
X-Cc: git@vger.kernel.org
X-Mail-Followup-To: "brian m. carlson" <sandals@crustytoothpaste.net>,
Jessica Clarke <jrtc27@jrtc27.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: <41F956FA-64BC-4F68-8619-2E8B9889C26F@jrtc27.com>
X-User-Agent: Mutt/2.4.1 (2026-07-04)