Re: [PATCH] meson: wire up USE_NSEC build knob
- From
D. Ben Knoble <ben.knoble+github@gmail.com>
- Date
- Jul 3, 2026, 15:46 UTC
- Message-ID
- <CALnO6CDm74rCBQu6Q0djsvtuw5U14V=PApptcZTgP+pic1f_AA@mail.gmail.com>
- In-Reply-To
- <20260630054314.GD2495216@coredump.intra.peff.net>
On Tue, Jun 30, 2026 at 1:43 AM Jeff King <peff@peff.net> wrote:
Show 35 quoted lines
> > On Mon, Jun 29, 2026 at 08:08:42AM +0200, Patrick Steinhardt wrote: > > > > True, but AFAICT it probably is safe these days, at least one some > > > platforms. > > > > Hm. That makes me wonder whether it is the completely wrong approach to > > make this a build option then. If it works on some systems and only on > > some filesystems, then a build option is just too coarse-grained. A > > distro wouldn't really be able to ever enable the option, unless it knew > > that repositories will only ever exist on a filesystem that works. Which > > I guess is an assumption that no distro can make. > > > > So instead, I wonder whether we should treat this the same as for > > example "core.ignoreCase", where we only use nanosecond resolution when > > opted in by the user. Ideally, if we had a way to detect brokenness, we > > could even make git-init(1) set it automatically. > > Yeah, this came up earlier in the thread. It would be nice if we could > set it automatically, but I'm not sure we have a good way of testing a > particular filesystem. I think the sequence is: > > 1. stat() a file, getting nanoseconds > > 2. somehow flush the kernel's in-core inode cache > > 3. stat() it again and compare > > Step 2 is the tricky part. ;) It's not only not portable, but probably > something that would annoy users if we did it for every repo creation. > > It would also be nice if we could actually verify that the sequence > above _does_ show the problem. I was not able to come up with a failing > instance on my modern Linux machine (even going as far as unmounting and > re-mounting for step 2).
Brian suggested in a sibling message that a statfs call could be used for "known-good" file system types, IIUC.
Show 5 quoted lines
> But I do agree in general that it should be a config flag and not a > build option. Run-time flags are more friendly to users when there is no > good reason to avoid them. > > -Peff
If we're all leaning in the direction of a run-time flag instead, I can noodle in that direction. That certainly involves a bit more surgery than just giving Meson access to the option, but the dynamism may be nice. I'm not too sure how we'd write a test case for it, though.