From 6b6cc80196f76c20e8339b5693b8db2bb1c9f372 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Fri, 18 Sep 2020 12:49:51 -0400 Subject: [PATCH] Support .zstd suffix only for decompression --- .gitignore | 1 + programs/fileio.c | 3 +++ programs/fileio.h | 1 + tests/playTests.sh | 5 ++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6188ab91..ae277e93 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ zstdmt # Test artefacts tmp* *.zst +*.zstd dictionary. dictionary NUL diff --git a/programs/fileio.c b/programs/fileio.c index b27f314a..1f2dabf4 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -2555,6 +2555,9 @@ int FIO_decompressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, static const char *suffixList[] = { ZSTD_EXTENSION, TZSTD_EXTENSION, +#ifndef ZSTD_NODECOMPRESS + ZSTD_ALT_EXTENSION, +#endif #ifdef ZSTD_GZDECOMPRESS GZ_EXTENSION, TGZ_EXTENSION, diff --git a/programs/fileio.h b/programs/fileio.h index bec651a1..1a0a35de 100644 --- a/programs/fileio.h +++ b/programs/fileio.h @@ -44,6 +44,7 @@ extern "C" { #define ZSTD_EXTENSION ".zst" #define TZSTD_EXTENSION ".tzst" +#define ZSTD_ALT_EXTENSION ".zstd" /* allow decompression of .zstd files */ #define LZ4_EXTENSION ".lz4" #define TLZ4_EXTENSION ".tlz4" diff --git a/tests/playTests.sh b/tests/playTests.sh index d9407db8..72a02918 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -1128,10 +1128,13 @@ if [ $LZ4MODE -ne 1 ]; then grep ".lz4" tmplg > $INTOVOID && die "Unsupported suffix listed" fi +touch tmp1 +zstd tmp1 -o tmp1.zstd +zstd -d tmp1.zstd # support .zstd suffix even though it's not the default suffix println "\n===> tar extension tests " -rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4 +rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4 tmp1.zstd datagen > tmp tar cf tmp.tar tmp