git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: USE_NSEC bug?

From
Jeff King <peff@peff.net>
Date
Mar 20, 2013, 07:53 UTC
Message-ID
<20130320075344.GA8159@sigill.intra.peff.net>
In-Reply-To
<CABFQKmP6=Thhph4Ug+4LOBmzsVK42qBQYW2QHw87QD3019n+Kw@mail.gmail.com>
On Wed, Mar 20, 2013 at 02:36:32AM -0400, Andrew Rodland wrote:
Show 6 quoted lines
> While investigating this StackOverflow question:
> http://stackoverflow.com/questions/15516168/how-to-cross-compile-git-for-arm
> I found that fetch-pack.c uses ST_MTIME_NSEC outside of the protection
> of #ifdef USE_NSEC. This results in a broken build if
> !defined(USE_NSEC) && !defined(NO_NSEC) and the target system doesn't
> happen to be recent glibc.

Right; the point of NO_NSEC is to tell git that your libc does not have those fields. If it's not set, then it is a bug in your config.mak (or in the autoconf script, if you are using it).

That being said, I really don't see the point of having both USE_NSEC and NO_NSEC. If you do not set USE_NSEC (which most people do not; it is off by default), what is the point of not setting NO_NSEC? As far as I can tell, it means we will copy stat information out "struct st" into the index, but we will not actually _use_ it for anything.

Should there just be a single option USE_NSEC that defaults to off? And if it is not set, we do not even bother caring whether libc provides nsec fields, since we are not going to use them for anything (i.e., we just do the equivalent of NO_NSEC now).

Which I think is the direction you are proposing with your patches below, but the rationale should be "why bother requiring users to use the NO_NSEC knob explicitly when we know we do not care about its value anyway".

But maybe there is some subtle reason I'm missing for having the two options separate. Or maybe it's just a historical accident that we ended up here.

-Peff
Previous: Andrew RodlandNext: Junio C Hamano
Message 2 of 9 in “USE_NSEC bug?”
  1. Andrew RodlandMar 20, 2013
  2. Jeff KingMar 20, 2013
  3. Junio C HamanoMar 20, 2013
  4. Jeff KingMar 20, 2013
  5. Junio C HamanoMar 20, 2013
  6. Andrew RodlandMar 20, 2013
  7. Jeff KingMar 20, 2013
  8. Junio C HamanoMar 20, 2013
  9. Jeff KingMar 20, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.