Re: [PATCH] archive: Store checksum correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux