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

Re: [PATCH 2/2] read-cache: use time_t instead of unsigned long

From
Carlo Arenas <carenas@gmail.com>
Date
Nov 13, 2018, 09:10 UTC
Message-ID
<CAPUEspgqUZ9eKAGug=SGRedR=KBQswpsTZU+0PYHdGsCA4iZLA@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.1811130948420.39@tvgsbejvaqbjf.bet>

On Tue, Nov 13, 2018 at 12:49 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 5 quoted lines
> On Mon, 12 Nov 2018, Carlo Marcelo Arenas Belón wrote:
>>
> > if time_t can't represent a valid time keep the indexes for failsafe
>
> Is this sentence incomplete? What are those "indexes"?
the indexes that are created when core.splitIndex = true

the code that was modified looks for a configuration parameter (or the default) that says something like "2 weeks ago" and that then converts that into a timestamp that can be compared with the modification time for the files that compose that index and then decides to delete anyone that is older than the "expiration date".

since time_t is used for the stat.mtime there is a chance that the timestamp might overflow its size, so if an overflow is detected we assume the value to be equivalent to "never" and keep the files.

note this scenario will only matter around 2038 and it should be fixed by then as part of the Year 2038 problem if we still care about 32-bit UNIX by then, 32-bit Windows has until next century.

Carlo
Previous: Johannes SchindelinNext: Junio C Hamano
Message 10 of 12 in “avoid unsigned long for timestamps”
  1. 0/2 avoid unsigned long for timestampsCarlo Marcelo Arenas Belón, Nov 12, 2018
  2. 1/2 builtin/commit: use timestamp_t in parse_force_dateCarlo Marcelo Arenas Belón, Nov 12, 2018
  3. 2/2 read-cache: use time_t instead of unsigned longCarlo Marcelo Arenas Belón, Nov 12, 2018
  4. Eric SunshineNov 12, 2018
  5. Junio C HamanoNov 12, 2018
  6. Johannes SchindelinNov 12, 2018
  7. Junio C HamanoNov 12, 2018
  8. 2/2 read-cache: use time_t instead of unsigned longCarlo Marcelo Arenas Belón, Nov 13, 2018
  9. Johannes SchindelinNov 13, 2018
  10. Carlo ArenasNov 13, 2018
  11. Junio C HamanoNov 13, 2018
  12. Johannes SchindelinNov 12, 2018

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.