Skip to content

zstd support #152

@Vinfall

Description

@Vinfall

Zstandard is a loseless compression algorithm, and dual-licensed under BSD OR GPLv2.

WSL supports importing quite a few formats already like .tar., .tar.xz, .tar.gz and .tar.zst.

I'm aware of #109 and agree with the size increase worry. Regarding implementation, do you mean a go package for the compression algorithms or something else? If you mean packages, I think this or this would work.

To test if it's possible, I just blindly modified

var (
defaultRootFiles = []string{"install.tar", "install.tar.gz", "rootfs.tar", "rootfs.tar.gz", "install.ext4.vhdx", "install.ext4.vhdx.gz"}
)
and gladly importing .tar.zst just works. A more thorough support would require importing the package and change
// uncompress and copy
rootPathLower := strings.ToLower(rootPath)
if strings.HasSuffix(rootPathLower, ".gz") {
// compressed with gzip
gr, err := gzip.NewReader(src)
if err != nil {
return err
}
_, err = io.Copy(dest, gr)
if err != nil {
return err
}
} else {
// not compressed
_, err = io.Copy(dest, src)
if err != nil {
return err
}
}
or wherever I'm unaware of.

A test build of wsldl is available here and I successfully built DevuanWSL based on that. Running Devuan.exe does register the instance and it works flawlessly as far as I can tell so it should be feasible I guess.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions