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

Re: Fw: Curiosity

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Dec 18, 2021, 01:34 UTC
Message-ID
<Yb06k5ob+bl/oE68@camp.crustytoothpaste.net>
In-Reply-To
<1X3gQ48NK5aBDHcpYMlxESRjqubcCBKJUQu2K0dBOnTyvsXCXXoGDBg2Ff4KarK6WsZnzN3HgqHGOlCKKdF-wtZQ5tHsoAcfit2CTXMWqh4=@protonmail.com>
On 2021-12-18 at 00:15:59, João Victor Bonfim wrote:
Show 9 quoted lines
> > I suspect that for most algorithms and their implementations, this would
> >
> > not result in repeatable "recompressed" results. Thus the checked-out
> >
> > files might be different every time you checked them out. :(
> 
> How or why?
> 
> Sincere question.

A lossless compression algorithm has to produce an encoded value that, when decoded, must produce the original input. Ideally, it will also reduce the file size of the original input. Beyond that, there's a great deal of freedom to implement that.

Just taking Deflate, which is used in zlib and gzip, as an example, there are different compression settings that control the size of the window to use that affect compression speed, quality of compression (resulting size), and memory usage. One might prefer using gzip -1 to get better performance or use less memory, or gzip -9 to reduce the file size as much as possible.

Even when the same settings are used, the technique used can vary between versions of the software. For example, GitHub effectively uses git archive to generate archives, and one time when they upgraded their servers, the compression changed in the tarballs and zip files, and everybody who was relying on the archives being bit-for-bit identical[0] had a problem.

So it would be nearly impossible to produce bit-for-bit repeatable results without specifying a specific, hard-coded implementation, and even in that case, the behavior might need to change for security reasons, so it would end up being difficult to achieve.

[0] Neither Git nor GitHub provides this guarantee, so please do not make this mistake. If you need a fixed bit-for-bit tarball, save it as a release artifact.

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Previous: Martin FickNext: João Victor Bonfim
Message 13 of 14 in “Fw: Curiosity”
  1. João Victor BonfimDec 15, 2021
  2. Junio C HamanoDec 15, 2021
  3. João Victor BonfimDec 15, 2021
  4. brian m. carlsonDec 16, 2021
  5. João Victor BonfimDec 16, 2021
  6. Martin FickDec 16, 2021
  7. Junio C HamanoDec 16, 2021
  8. João Victor BonfimDec 18, 2021
  9. João Victor BonfimDec 18, 2021
  10. Junio C HamanoDec 18, 2021
  11. João Victor BonfimDec 18, 2021
  12. Martin FickDec 18, 2021
  13. brian m. carlsonDec 18, 2021
  14. João Victor BonfimDec 18, 2021

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.