[Toybox] [PATCH] file, tar: basic zstd awareness.

Rob Landley rob at landley.net
Sat Dec 7 21:51:05 PST 2024


On 12/7/24 18:39, enh wrote:
> On Sat, Dec 7, 2024, 18:25 Rob Landley <rob at landley.net> wrote:
> 
>> On 12/6/24 13:57, enh wrote:
>>> We're seeing ever more zstd-compressed files in the wild, so even though
>>> toybox can't compress/decompress zstd without an external helper, it
>>> still seems useful to integrate with any that happens to be on the
>>> system.
>>
>> No short option for zstd, even though every other explicit archive
>> format has one?
>>
> 
> technically there are a couple of other compression options that are
> longopt only,

In gnu/gnu.

> such as --lzma (but i haven't added those here because i've
> yet to see them used).
> 
> this probably made sense when it was added in 2019, and it wasn't clear how
> popular, zstd was going to become. (especially in comparison to the other
> options we don't have.)
> 
> though tbh, zstd seems more popular in non-tar contexts ... i had to ask
> the internet what the long and short extensions were!

Imma hijack -Z. I'm aware in debian that's "compress" but we've never 
supported that format, which was patented in the 1980s causing it to be 
completely replaced by gzip except for some old legacy archives you can 
"compress -d file.Z | tar x" if you like.

(I just like there to BE a short option, and another obvious contender 
isn't presenting itself. Plus I haven't got an obvious way to test this 
anyway.)

Hmmm...

https://www.rfc-editor.org/rfc/rfc8878.txt

And according to https://github.com/facebook/zstd the "reference 
implementation" is dual licensed BSD and GPL. How bad is...

https://github.com/facebook/zstd/blob/dev/lib/legacy/zstd_legacy.h

Nope, that's terrifying. But:

https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md

Looks possibly doable.

Rob


More information about the Toybox mailing list