Git development
 help / color / mirror / Atom feed
From: Ben Knoble <ben.knoble@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Patrick Steinhardt <ps@pks.im>, Todd Zullinger <tmz@pobox.com>,
	Olamide Caleb Bello <belkid98@gmail.com>,
	Yuchen Tian <cat@malon.dev>
Subject: Re: [PATCH v6 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec
Date: Wed, 2 Sep 2026 07:45:38 -0400	[thread overview]
Message-ID: <B02189AD-DEC3-4117-8505-AAFA56494822@gmail.com> (raw)
In-Reply-To: <20260902072646.GB70165@coredump.intra.peff.net>


> Le 2 sept. 2026 à 03:26, Jeff King <peff@peff.net> a écrit :
> 
> On Tue, Sep 01, 2026 at 08:36:22AM -0400, D. Ben Knoble wrote:
> 
>>> This hunk made me wonder if we even need to do any build-time magic here
>>> at all. If your platform doesn't support nanosecond stat entries, then
>>> you're probably not going to ask for core.usenanosec in the first place.
>>> But if you do, I think the code still works; we fake the entries as "0",
>>> so they'd always yield a racy tie, just as if core.usenanosec was
>>> disabled.
>> 
>> At first I thought you meant we fake the cfg->use_nanosec as 0; it
>> took me a moment to realize you mean that we fake the index entries as
>> 0ns. (That is what you mean, right?)
> 
> Yeah, sorry to be unclear. I meant that we still have this code:
> 
>  #ifdef NO_NSEC
>  #define ST_CTIME_NSEC(st) 0
>  #define ST_MTIME_NSEC(st) 0
> 
> So we are free to pretend that stat nsecs exist and compare them.
> 
>> In that case, yes, I suppose it would work. Might be confusing in a
>> debugger to see use_nanosec set and checked, though?
> 
> Maybe. Looking at the list of NO_NSEC flags in config.mak.uname, I
> suspect it's a pretty small population in the first place.
> 
>> Hm, yeah. I haven't thought too hard either about the interactions
>> where you toggle core.usenanosec on and off, but giving it an initial
>> think they seem fine. Unlike this hypothetical case, when it's off we
>> don't look at the ns fields, so I don't think we end up with any false
>> negatives.
>> 
>> And in this hypothetical, by restricting the option parsing we avoid
>> reading the ns values on unsupported platforms, I think?
> 
> I'd have to double check, but I thought that even without USE_NSEC (and
> thus even with your new core.usenanosec off) we still read and store the
> nanosecond values in the index, as long as the platform supports it (and
> if not, then we use those "0" fallback values).
> 
> So they are always there in the index. I guess the same odd sequence
> applies even today. If you:
> 
>  1. Build with NO_NSEC and get "fake" 0 values in your index.
> 
>  2. Re-build without NO_NSEC, and also enable USE_NSEC. Now we get
>     _real_ values when we stat(), and compare them to the fake values
>     in the index.
> 
> Now the index values appear up to 1-second older than they actually are.
> Which could maybe yield a racy miss of an update? Probably not for
> stat-freshness (where we want an exact match), but maybe for some index
> vs entry racy-git comparison. I didn't think that hard about it, because
> at some point this sequence is just kind of insane.
> 
>> The build-time conditional _does_ mean that if your distro (e.g.)
>> provides a NO_NSEC build, you can't access the core.usenanosec feature
>> without compiling yourself, even if your platform supports it. But I
>> haven't thought too hard either about what it looks like to get rid of
>> NO_NSEC entirely, and I'm not totally sure if that's a good idea.
> 
> You couldn't access it even if core.usenanosec is supported in the
> build, because your fake nsec values would all be "0" and it's
> effectively a noop. ;)
> 
> My suggestion wasn't really about supporting more cases, but just about
> making the code simpler by having one less #ifdef. But like I said
> earlier, we can't get rid of the NO_NSEC knob entirely, so it's probably
> not worth worrying about the one #ifdef either way.
> 
> -Peff

Right on. Always good to find myself nodding along with your explanations :)

  reply	other threads:[~2026-09-02 11:45 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 11:56 [PATCH 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-07 11:56 ` [PATCH 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-10 12:50   ` Patrick Steinhardt
2026-08-07 11:56 ` [PATCH 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-07 11:56 ` [PATCH 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-07 21:17   ` Junio C Hamano
2026-08-08 16:31     ` SZEDER Gábor
2026-08-10 12:27       ` D. Ben Knoble
2026-08-10 12:27     ` D. Ben Knoble
2026-08-10 12:44       ` Patrick Steinhardt
2026-08-11 16:26         ` Ben Knoble
2026-08-13 21:40           ` D. Ben Knoble
2026-08-14 11:06             ` Patrick Steinhardt
2026-08-14 11:29               ` Ben Knoble
2026-08-10 12:50   ` Patrick Steinhardt
2026-08-14 12:33 ` [PATCH v2 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-14 12:34   ` [PATCH v2 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-14 12:34   ` [PATCH v2 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-14 12:34   ` [PATCH v2 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-14 16:38     ` Junio C Hamano
2026-08-14 19:03       ` D. Ben Knoble
2026-08-18 14:59 ` [PATCH v3 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-18 14:59   ` [PATCH v3 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-18 14:59   ` [PATCH v3 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-18 14:59   ` [PATCH v3 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-18 18:51     ` Junio C Hamano
2026-08-19 12:53       ` D. Ben Knoble
2026-08-19  8:24     ` Patrick Steinhardt
2026-08-19 13:09       ` D. Ben Knoble
2026-08-20  5:24         ` Patrick Steinhardt
2026-08-20 11:50           ` D. Ben Knoble
2026-08-19 16:15       ` Junio C Hamano
2026-08-19 22:56         ` D. Ben Knoble
2026-08-20  5:26         ` Patrick Steinhardt
2026-08-20 13:18 ` [PATCH v4 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-20 13:18   ` [PATCH v4 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-20 13:18   ` [PATCH v4 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-20 17:45     ` Junio C Hamano
2026-08-21 12:10       ` D. Ben Knoble
2026-08-20 13:18   ` [PATCH v4 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-29 13:38   ` [PATCH v5 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-29 13:38     ` [PATCH v5 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-29 13:38     ` [PATCH v5 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-29 13:38     ` [PATCH v5 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-08-30 21:15       ` Junio C Hamano
2026-08-31  0:27         ` D. Ben Knoble
2026-08-31  9:27           ` Patrick Steinhardt
2026-08-31 13:00             ` D. Ben Knoble
     [not found]             ` <CALnO6CCNwXC1_PUCTWEU-HXBk+W+sBGqn7Sr8D=ZHW3Mxcu20g@mail.gmail.com>
2026-08-31 14:47               ` Patrick Steinhardt
2026-09-01  0:35                 ` Ben Knoble
2026-08-31  9:27       ` Patrick Steinhardt
2026-08-31 15:46         ` Ben Knoble
2026-08-31 20:01   ` [PATCH v6 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-08-31 20:01     ` [PATCH v6 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-08-31 20:01     ` [PATCH v6 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-08-31 20:01     ` [PATCH v6 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-09-01  4:35       ` Junio C Hamano
2026-09-01 12:38         ` D. Ben Knoble
2026-09-01 17:32           ` Junio C Hamano
2026-09-01  4:54       ` Jeff King
2026-09-01 12:36         ` D. Ben Knoble
2026-09-02  7:26           ` Jeff King
2026-09-02 11:45             ` Ben Knoble [this message]
2026-09-02 21:05               ` Junio C Hamano
2026-09-03  1:00                 ` Ben Knoble
2026-09-03 15:56                   ` Junio C Hamano
2026-09-03 18:16                     ` Ben Knoble
2026-08-31 20:06     ` [PATCH v6 0/3] Convert USE_NSEC to runtime config D. Ben Knoble
2026-09-11 12:32   ` [PATCH v7 " D. Ben Knoble
2026-09-11 12:32     ` [PATCH v7 1/3] meson: expose knob for xmlto relative links in manuals D. Ben Knoble
2026-09-11 12:32     ` [PATCH v7 2/3] environment: align repo_config_values_init with struct declaration D. Ben Knoble
2026-09-11 12:32     ` [PATCH v7 3/3] core: convert build-time USE_NSEC into runtime core.useNanosec D. Ben Knoble
2026-09-11 18:35     ` [PATCH v7 0/3] Convert USE_NSEC to runtime config Junio C Hamano
2026-09-11 20:16       ` Ben Knoble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B02189AD-DEC3-4117-8505-AAFA56494822@gmail.com \
    --to=ben.knoble@gmail.com \
    --cc=belkid98@gmail.com \
    --cc=cat@malon.dev \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox