bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] [PATCH] ZSTD compression support.


From: Nick Terrell
Subject: Re: [Bug-tar] [PATCH] ZSTD compression support.
Date: Thu, 16 Nov 2017 00:17:27 +0000

On 11/15/17, 1:03 PM, "Adam Borowski" <address@hidden> wrote:
> Its customary file extension is ".zst", while some tools use ".tzst" as a
> shorthand for ".tar.zst".

I've tested your patch with this script. I think I've covered most of the
surface area, but I'm sure there are some niche features that this doesn't
cover.

```
#!/bin/bash
set -e

# USAGE: test.sh /path/to/tar file
TAR=$1
FILE=$2

# Test decompression based on magic bytes
$TAR --zstd -cf file.ext $FILE
$TAR --zstd -xf file.ext       # Test tar can extract it
zstd -t file.ext               # Test that zstd can decompress it
$TAR -caf file.tar.zst $FILE
$TAR -xf file.tar.zst
zstd -t file.tar.zst
$TAR -caf file.tzst $FILE
$TAR -xf file.tzst
zstd -t file.tar.zst

# Zstd allows "skippable frames" that it ignores.
# Prepend an empty one to the tar file to foil the magic byte detection.
# This forces tar to fall back to suffix detection.
cat <(echo "502a 4d18 0000 0000" | xxd -r -p) file.tar.zst > tmp.tar.ext
cp tmp.tar.ext tmp.tar.zst
cp tmp.tar.ext tmp.tzst
zstd -t tmp.tar.ext             # Test zstd can still decompress it

$TAR -xf tmp.tar.zst
$TAR -xf tmp.tzst
! $TAR -xf tmp.tar.ext          # It should fail with a bad extension
```
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]