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

Re: [PATCH] name-rev: avoid cutoff timestamp underflow

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 23, 2019, 19:16 UTC
Message-ID
<fe58f33f-a3ae-4981-5bb7-d1659f3ab189@kdbg.org>
In-Reply-To
<20190923083723.GD10866@szeder.dev>
Am 23.09.19 um 10:37 schrieb SZEDER Gábor:
Show 16 quoted lines
> On Sun, Sep 22, 2019 at 11:01:26PM +0200, Johannes Sixt wrote:
>> Huh? For signed cutoff and positive CUTOFF_DATE_SLOP,
>> cutoff - CUTOFF_DATE_SLOP < cutoff is ALWAYS true. Signed interger
>> underflow is undefined behavior and signed integer arithmetic does not
>> wrap around!
>>
>> IOW, the new condition makes only sense today, because cutoff is an
>> unsigned type, but breaks down should we switch to a signed type.
> 
> Yeah, that's what I meant with worrying about signed underflow in the
> commit message.  As long as the cutoff is at least a day later than
> the minimum value of our future signed 'timestamp_t', the condition
> does the right thing.  And considering that oldest time a signed 64
> bit timestamp can represent far exceeds the age of the universe, and
> the oldest value of even a signed 32 bit timestamp is almost half the
> age of the Earth, I wasn't too worried.

Note that commits and timestamps can be forged easily. I'm not worried that Git does not work "correctly" with forged timestamps (as long as it is not exploitable); but when it is simple to make foolproof, we should do it.

BTW, 32-bit timestamps cover just ~135 years (not half the age of Earth). That's too little for people who want to store historic documents in a Git repository.

-- Hannes
Previous: Phillip WoodNext: SZEDER Gábor
Message 7 of 11 in “name-rev: avoid cutoff timestamp underflow”
  1. name-rev: avoid cutoff timestamp underflowSZEDER Gábor, Sep 22, 2019
  2. Phillip WoodSep 22, 2019
  3. SZEDER GáborSep 22, 2019
  4. Johannes SixtSep 22, 2019
  5. SZEDER GáborSep 23, 2019
  6. Phillip WoodSep 23, 2019
  7. Johannes SixtSep 23, 2019
  8. SZEDER GáborSep 24, 2019
  9. brian m. carlsonSep 23, 2019
  10. SZEDER GáborSep 23, 2019
  11. name-rev: avoid cutoff timestamp underflowSZEDER Gábor, Sep 24, 2019

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.