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

Re: [PATCH] archive-zip: omit UT extra field if mtime is out of range

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 12, 2026, 15:07 UTC
Message-ID
<xmqqpkxf9ctv.fsf@gitster.g>
In-Reply-To
<CA+h9NxRQLP=20kfmSm6B2WtkkmHDCfdRDZEawOpzFF1LoghTEA@mail.gmail.com>
m@sph3r3.com writes:
> For the i386 failure Junio reported, the beyond-2038 archive test and
> its dependent omission check should use TIME_T_IS_64BIT. TIME_IS_64BIT
> checks Git's timestamp_t, which can be 64-bit while time_t is 32-bit.
;-)
Thanks.  It is an obvious thing, only once it is pointed out X-<.

These two prerequisites sound too similar, and the latter probably is no longer very relevant in the modern world, but that was what was used in the test.

TIME_T_IS_64BIT measures how wide sizeof(time_t) is, which makes sense as a portability test across platforms.

But TIME_IS_64BIT? It measures how wide sizeof(timestamp_t) is, but the thing is, it is uintmax_t everywhere as far as "git grep" can see.

        $ git grep -n -e 'typedef .*timestamp_t' :/
        compat/posix.h:267:typedef uintmax_t timestamp_t;
        $ git grep -n -e timestamp_t\; :/\*.h
        compat/posix.h:267:typedef uintmax_t timestamp_t;

So TIME_IS_64BIT can be true even if TIME_T_IS_64BIT is not. Unless we are on a platform where uintmax_t is 32-bit wide, TIME_IS_64BIT would be true. And the time value from the system that is delibered to us initially in time_t would be limited by that even if timestamp_t is wider. TIME_IS_64BIT would not have much value as TIME_T_IS_64BIT as a portability guard to tests that require wider time values across the callstack.

Perhaps we should audit places where timestamp_t value is read from SCM data and coerced into time_t to expose it in a form that outside world (like ZIP archive format) would understand and warn when we truncate values? I will leave it as #leftoverbits for others to think about it through ;-).

Thanks.
Previous: René ScharfeNext: René Scharfe
Message 12 of 14 in “[BUG] ZIP timestamp conversion and strict fast-import date validation”
  1. Matthew E. LuallenOct 5, 2026
  2. René ScharfeOct 5, 2026
  3. Matthew E. LuallenOct 5, 2026
  4. René ScharfeOct 7, 2026
  5. m@sph3r3.comOct 6, 2026
  6. archive-zip: omit UT extra field if mtime is out of rangeRené Scharfe, Oct 11, 2026
  7. Junio C HamanoOct 12, 2026
  8. René ScharfeOct 12, 2026
  9. m@sph3r3.comOct 12, 2026
  10. René ScharfeOct 12, 2026
  11. René ScharfeOct 19, 2026
  12. Junio C HamanoOct 12, 2026
  13. archive-zip: omit UT extra field if mtime is out of rangeRené Scharfe, Oct 19, 2026
  14. m@sph3r3.comOct 20, 2026

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.