* [PATCH] meson: wire up USE_NSEC build knob
@ 2026-06-20 16:00 D. Ben Knoble
2026-06-21 1:01 ` Junio C Hamano
2026-06-21 17:49 ` Jeff King
0 siblings, 2 replies; 6+ messages in thread
From: D. Ben Knoble @ 2026-06-20 16:00 UTC (permalink / raw)
To: git
Cc: D. Ben Knoble, brian m . carlson, Junio C Hamano, Jeff King,
Patrick Steinhardt, Ramsay Jones
Autotools-style builds permit enabling USE_NSEC for cases where that's
desired; the equivalent knob is missing from meson-based builds.
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
meson.build | 4 ++++
meson_options.txt | 2 ++
2 files changed, 6 insertions(+)
diff --git a/meson.build b/meson.build
index 3247697f74..85a11119c5 100644
--- a/meson.build
+++ b/meson.build
@@ -838,6 +838,10 @@ if help_format_opt != 'man'
libgit_c_args += '-DDEFAULT_HELP_FORMAT="' + help_format_opt + '"'
endif
+if get_option('nanosec')
+ libgit_c_args += '-DUSE_NSEC'
+endif
+
libgit_include_directories = [ '.' ]
libgit_dependencies = [ ]
diff --git a/meson_options.txt b/meson_options.txt
index d936ada098..1bc75278a8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,6 +21,8 @@ option('runtime_prefix', type: 'boolean', value: false,
description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
option('sane_tool_path', type: 'array', value: [],
description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')
+option('nanosec', type: 'boolean', value: false,
+ description: 'Care about sub-second file mtimes and ctimes.')
# Build information compiled into Git and other parts like documentation.
option('build_date', type: 'string', value: '',
base-commit: 0c8ab3ebcc76981376809c8fe632d0fe18e93347
--
2.55.0.rc0.738.g0c8ab3ebcc.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] meson: wire up USE_NSEC build knob
2026-06-20 16:00 [PATCH] meson: wire up USE_NSEC build knob D. Ben Knoble
@ 2026-06-21 1:01 ` Junio C Hamano
2026-06-21 16:41 ` D. Ben Knoble
2026-06-22 8:13 ` Patrick Steinhardt
2026-06-21 17:49 ` Jeff King
1 sibling, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2026-06-21 1:01 UTC (permalink / raw)
To: D. Ben Knoble
Cc: git, brian m . carlson, Jeff King, Patrick Steinhardt,
Ramsay Jones
"D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
> Autotools-style builds permit enabling USE_NSEC for cases where that's
> desired; the equivalent knob is missing from meson-based builds.
With or without autoconf, Makefile based build can use USE_NSEC. It
is a welcome addition to the other side of thw world. I do not know
if 'meson setup -Dnanosec=true' is a name that is easy to discover,
though.
Will queue. Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] meson: wire up USE_NSEC build knob
2026-06-21 1:01 ` Junio C Hamano
@ 2026-06-21 16:41 ` D. Ben Knoble
2026-06-22 8:13 ` Patrick Steinhardt
1 sibling, 0 replies; 6+ messages in thread
From: D. Ben Knoble @ 2026-06-21 16:41 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, brian m . carlson, Jeff King, Patrick Steinhardt,
Ramsay Jones
On Sat, Jun 20, 2026 at 9:01 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
>
> > Autotools-style builds permit enabling USE_NSEC for cases where that's
> > desired; the equivalent knob is missing from meson-based builds.
>
> With or without autoconf, Makefile based build can use USE_NSEC.
Thanks. I almost wrote "Make-based," but I wasn't sure how we
preferred to describe it.
> It
> is a welcome addition to the other side of thw world. I do not know
> if 'meson setup -Dnanosec=true' is a name that is easy to discover,
> though.
>
> Will queue. Thanks.
Agreed for the name. Alternatives welcome.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] meson: wire up USE_NSEC build knob
2026-06-21 1:01 ` Junio C Hamano
2026-06-21 16:41 ` D. Ben Knoble
@ 2026-06-22 8:13 ` Patrick Steinhardt
1 sibling, 0 replies; 6+ messages in thread
From: Patrick Steinhardt @ 2026-06-22 8:13 UTC (permalink / raw)
To: Junio C Hamano
Cc: D. Ben Knoble, git, brian m . carlson, Jeff King, Ramsay Jones
On Sat, Jun 20, 2026 at 06:01:25PM -0700, Junio C Hamano wrote:
> "D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
>
> > Autotools-style builds permit enabling USE_NSEC for cases where that's
> > desired; the equivalent knob is missing from meson-based builds.
>
> With or without autoconf, Makefile based build can use USE_NSEC. It
> is a welcome addition to the other side of thw world. I do not know
> if 'meson setup -Dnanosec=true' is a name that is easy to discover,
> though.
I think the name itself is fine. As is the case for other options, it
can be discovered rather easily by just running `meson setup` in the
source directory, which gives you an overview of all available build
options.
Patrick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] meson: wire up USE_NSEC build knob
2026-06-20 16:00 [PATCH] meson: wire up USE_NSEC build knob D. Ben Knoble
2026-06-21 1:01 ` Junio C Hamano
@ 2026-06-21 17:49 ` Jeff King
2026-06-22 8:13 ` Patrick Steinhardt
1 sibling, 1 reply; 6+ messages in thread
From: Jeff King @ 2026-06-21 17:49 UTC (permalink / raw)
To: D. Ben Knoble
Cc: git, brian m . carlson, Junio C Hamano, Patrick Steinhardt,
Ramsay Jones
On Sat, Jun 20, 2026 at 12:00:24PM -0400, D. Ben Knoble wrote:
> Autotools-style builds permit enabling USE_NSEC for cases where that's
> desired; the equivalent knob is missing from meson-based builds.
Seems reasonable. This is not changing the defaults at all, but just
bringing meson's options to parity with the Makefile.
I'm not still not sure if turning on USE_NSEC is a good idea. There's
some discussion in Documentation/technical/racy-git.adoc:
With `USE_NSEC`
compile-time option, `st_mtim.tv_nsec` and `st_ctim.tv_nsec`
members are also compared. On Linux, this is not enabled by default
because in-core timestamps can have finer granularity than
on-disk timestamps, resulting in meaningless changes when an
inode is evicted from the inode cache. See commit 8ce13b0
of git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
([PATCH] Sync in core time granularity with filesystems,
2005-01-04). This patch is included in kernel 2.6.11 and newer, but
only fixes the issue for file systems with exactly 1 ns or 1 s
resolution. Other file systems are still broken in current Linux
kernels (e.g. CEPH, CIFS, NTFS, UDF), see
https://lore.kernel.org/lkml/5577240D.7020309@gmail.com/
That's the most succinct description of the problem I've seen, but I
have no idea how widely it still applies. Kernel 2.6.11 is quite old
now, but I could believe that other filesystems (especially network
ones) still exhibit the issue.
So I guess if we wanted to go further it would take some digging as to
how each platform behaves, and then flipping the config.make.uname knob
for ones where it can be argued that the behavior is always reasonable.
But that's all outside the scope of your patch here.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] meson: wire up USE_NSEC build knob
2026-06-21 17:49 ` Jeff King
@ 2026-06-22 8:13 ` Patrick Steinhardt
0 siblings, 0 replies; 6+ messages in thread
From: Patrick Steinhardt @ 2026-06-22 8:13 UTC (permalink / raw)
To: Jeff King
Cc: D. Ben Knoble, git, brian m . carlson, Junio C Hamano,
Ramsay Jones
On Sun, Jun 21, 2026 at 01:49:34PM -0400, Jeff King wrote:
> On Sat, Jun 20, 2026 at 12:00:24PM -0400, D. Ben Knoble wrote:
>
> > Autotools-style builds permit enabling USE_NSEC for cases where that's
> > desired; the equivalent knob is missing from meson-based builds.
>
> Seems reasonable. This is not changing the defaults at all, but just
> bringing meson's options to parity with the Makefile.
I was originally wondering whether I should recommend that Meson can
auto-discover the availability of nanoseconds. But your below remarks
make me question that.
> I'm not still not sure if turning on USE_NSEC is a good idea. There's
> some discussion in Documentation/technical/racy-git.adoc:
>
> With `USE_NSEC`
> compile-time option, `st_mtim.tv_nsec` and `st_ctim.tv_nsec`
> members are also compared. On Linux, this is not enabled by default
> because in-core timestamps can have finer granularity than
> on-disk timestamps, resulting in meaningless changes when an
> inode is evicted from the inode cache. See commit 8ce13b0
> of git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
> ([PATCH] Sync in core time granularity with filesystems,
> 2005-01-04). This patch is included in kernel 2.6.11 and newer, but
> only fixes the issue for file systems with exactly 1 ns or 1 s
> resolution. Other file systems are still broken in current Linux
> kernels (e.g. CEPH, CIFS, NTFS, UDF), see
> https://lore.kernel.org/lkml/5577240D.7020309@gmail.com/
>
> That's the most succinct description of the problem I've seen, but I
> have no idea how widely it still applies. Kernel 2.6.11 is quite old
> now, but I could believe that other filesystems (especially network
> ones) still exhibit the issue.
>
> So I guess if we wanted to go further it would take some digging as to
> how each platform behaves, and then flipping the config.make.uname knob
> for ones where it can be argued that the behavior is always reasonable.
Yeah, it would be nice indeed to figure out whether these concerns still
apply. If they do, I would argue that it might even make sense to remove
the build option completely. It doesn't really make sense in my opinion
to have a build option that nobody uses and that is subtly broken when
enabled.
> But that's all outside the scope of your patch here.
Kind of, I guess. If we figure that this mechanism is still subtly broken
then I'd argue that it doesn't make sense to expose the option via
Meson.
Patrick
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-22 8:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-20 16:00 [PATCH] meson: wire up USE_NSEC build knob D. Ben Knoble
2026-06-21 1:01 ` Junio C Hamano
2026-06-21 16:41 ` D. Ben Knoble
2026-06-22 8:13 ` Patrick Steinhardt
2026-06-21 17:49 ` Jeff King
2026-06-22 8:13 ` Patrick Steinhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox