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

Re: [PATCH] archive: Store checksum correctly

From
DODavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date
Jul 23, 2019, 21:34 UTC
Message-ID
<25d47ba2-a22c-cafc-150d-c649d6aead9f@sigma-star.at>
In-Reply-To
<9a0c89e4-b216-86f1-c721-c54fb2ee0a10@web.de>
Hi,

the implementation of tar2sqfs was primarily based on `man 5 tar`[0], Wikipedia[1] and trial/error with archives generated by GNU tar and samples from [2] which I also integrated as test cases.

On 7/23/19 10:08 PM, René Scharfe wrote:
Show 8 quoted lines
> Am 23.07.19 um 21:38 schrieb René Scharfe:
>> is_checksum_valid() in
>> https://github.com/AgentD/squashfs-tools-ng/blob/master/lib/tar/checksum.c
>> compares the formatted checksum byte-by-byte.  That seems
>> unnecessarily strict.  Parsing and comparing the numerical value
>> of the checksum would be more forgiving, better adhere to POSIX and
>> might be a tiny bit quicker.
>

I agree with that. The current code was probably the simplest way to move forward with existing code after implementing sqfs2tar and it stayed that way, since it worked with all archives I tested it with.

As for every file format parser, tar2sqfs should of course be as tolerant as possible in what it accepts.

> I mean something like the patch below.  Code and text size are bigger,
> but it's more lenient and writes less.  Untested.
> 

I applied and tested the patch. It looks similar to the solution I came up with and the test cases still pass. Also, on my system tar2sqfs now accepts git-archive tar balls which it didn't before applying the patch, so I would go with this.

Thanks,
David

[0] https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+12.0-RELEASE&arch=default&format=html [1] https://en.wikipedia.org/wiki/Tar_(computing)#File_format [2] https://dev.gentoo.org/~mgorny/articles/portability-of-tar-features.html

Previous: René ScharfeNext: Junio C Hamano
Message 6 of 8 in “archive: Store checksum correctly”
  1. archive: Store checksum correctlyMatt Turner, Jul 23, 2019
  2. Junio C HamanoJul 23, 2019
  3. Jeff KingJul 23, 2019
  4. René ScharfeJul 23, 2019
  5. René ScharfeJul 23, 2019
  6. David OberhollenzerJul 23, 2019
  7. Junio C HamanoJul 23, 2019
  8. Jonathan NiederJul 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.