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

Re: git 1.6.6.1 on glibc 2.2

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 24, 2010, 17:40 UTC
Message-ID
<20100124174008.GA7622@progeny.tock>
In-Reply-To
<x6d40zmte6@gzp>
Gabor Z. Papp wrote:
>| Gabor Z. Papp wrote:
>|> trying to compile git 1.6.6.1 on Linux 2.4.37.7, glibc 2.2.5:
>|> 
>|> read-cache.c: In function 'fill_stat_cache_info':
>|> read-cache.c:72: error: 'struct stat' has no member named 'st_ctim'
[...] 
> Thanks Jonathan, compiles fine defining NO_NSEC, but my glibc is 2.2.5
> and the comment abot USE_NSEC says it requires at least glibc
> 2.2.4. Maybe the comment is wrong? glibc 2.3.6 compiles fine.
Hmm, in the glibc changelog I find this, from ChangeLog.14:
| 2003-01-04  Andreas Schwab  <schwab@suse.de>
|
|	* sysdeps/unix/sysv/linux/m68k/bits/stat.h: Add nanosecond fields.
That’s around the time of glibc 2.3.2.
The stat(2) man page tells a little more:
| Since kernel 2.5.48, the stat structure supports nanosecond resolution for
| the  three  file timestamp fields.  Glibc exposes the nanosecond component
| of each field using names either  of  the  form  st_atim.tv_nsec,  if  the
| _BSD_SOURCE  or _SVID_SOURCE feature test macro is defined, or of the form
| st_atimensec, if neither of these macros is defined.  On file systems that
| do not support sub-second timestamps, these nanosecond fields are returned
| with the value 0.

Searching a little harder yields commit cvs/glibc-2_3_2~418 (2002-12-31) of git://sourceware.org/git/glibc.git, in which the feature was added. There’s a lovely discussion about it from then on libc-alpha. [1]

The comment you mention is from commit bdd4da5 (Make nsec checking optional, 2005-04-13); I am guessing 2.2.4 was just mentioned as a lower bound.

So how about something like the following? Please feel free to write something better --- in particular, I am not sure the documentation for USE_NSEC is the most obvious place to look when something goes wrong.

Thanks, Jonathan

[1] http://sourceware.org/ml/libc-alpha/2002-12/threads.html#00011
-- %< --
Subject: Makefile: document minimal glibc version supporting tv_nsec

Compiling git with the default settings and old glibc produces errors like the following:

| read-cache.c: In function 'fill_stat_cache_info':
| read-cache.c:72: error: 'struct stat' has no member named 'st_ctim'

The Makefile seems to imply that versions after 2.2.4 should be okay, but that is not true: NO_NSEC must be set to build with glibc versions before 2.3.2.

Reported-by: Gabor Z. Papp <gzp@papp.hu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/Makefile b/Makefile
index fd7f51e..8ebc966 100644
--- a/Makefile
+++ b/Makefile
@@ -134,7 +134,7 @@ all::
 # "-Wl,-rpath=/path/lib" is used instead.
 #
 # Define USE_NSEC below if you want git to care about sub-second file mtimes
-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
+# and ctimes. Note that you need recent glibc (at least 2.3.2) for this, and
 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
 # randomly break unless your underlying filesystem supports those sub-second
 # times (my ext3 doesn't).
Previous: Gabor Z. Papp
Message 4 of 4 in “git 1.6.6.1 on glibc 2.2”
  1. Gabor Z. PappJan 24, 2010
  2. Jonathan NiederJan 24, 2010
  3. Gabor Z. PappJan 24, 2010
  4. Jonathan NiederJan 24, 2010

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.