[arch-commits] Commit in zstd/trunk (3 files)
Bartłomiej Piotrowski
bpiotrowski at archlinux.org
Tue Jul 3 10:20:36 UTC 2018
Date: Tuesday, July 3, 2018 @ 10:20:36
Author: bpiotrowski
Revision: 327925
1.3.5-1
Added:
zstd/trunk/zstd-1.3.5-fix-tests.patch
Modified:
zstd/trunk/PKGBUILD
Deleted:
zstd/trunk/0001-Only-load-extra-table-positions-for-CDicts.patch
-------------------------------------------------------+
0001-Only-load-extra-table-positions-for-CDicts.patch | 338 ----------------
PKGBUILD | 11
zstd-1.3.5-fix-tests.patch | 97 ++++
3 files changed, 102 insertions(+), 344 deletions(-)
Deleted: 0001-Only-load-extra-table-positions-for-CDicts.patch
===================================================================
--- 0001-Only-load-extra-table-positions-for-CDicts.patch 2018-07-03 10:05:48 UTC (rev 327924)
+++ 0001-Only-load-extra-table-positions-for-CDicts.patch 2018-07-03 10:20:36 UTC (rev 327925)
@@ -1,338 +0,0 @@
-From 295ab0dbfa5cf822fb7d41b4a825e53d3451677a Mon Sep 17 00:00:00 2001
-From: Nick Terrell <terrelln at fb.com>
-Date: Mon, 2 Apr 2018 14:41:30 -0700
-Subject: [PATCH] Only load extra table positions for CDicts
-
-Zstdmt uses prefixes to load the overlap between segments. Loading extra
-positions makes compression non-deterministic, depending on the previous
-job the context was used for. Since loading extra position takes extra
-time as well, only do it when creating a `ZSTD_CDict`.
-
-Fixes #1077.
----
- lib/compress/zstd_compress.c | 43 +++++++++++++++++----------
- lib/compress/zstd_compress_internal.h | 4 ++-
- lib/compress/zstd_double_fast.c | 5 +++-
- lib/compress/zstd_double_fast.h | 2 +-
- lib/compress/zstd_fast.c | 5 +++-
- lib/compress/zstd_fast.h | 2 +-
- lib/compress/zstd_ldm.c | 4 +--
- lib/compress/zstdmt_compress.c | 3 +-
- 8 files changed, 44 insertions(+), 24 deletions(-)
-
-diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c
-index 2aa26da4..36b91030 100644
---- a/lib/compress/zstd_compress.c
-+++ b/lib/compress/zstd_compress.c
-@@ -2190,7 +2190,10 @@ size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const
- /*! ZSTD_loadDictionaryContent() :
- * @return : 0, or an error code
- */
--static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* src, size_t srcSize)
-+static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
-+ ZSTD_CCtx_params const* params,
-+ const void* src, size_t srcSize,
-+ ZSTD_dictTableLoadMethod_e dtlm)
- {
- const BYTE* const ip = (const BYTE*) src;
- const BYTE* const iend = ip + srcSize;
-@@ -2204,10 +2207,10 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, ZSTD_CCtx_params
- switch(params->cParams.strategy)
- {
- case ZSTD_fast:
-- ZSTD_fillHashTable(ms, cParams, iend);
-+ ZSTD_fillHashTable(ms, cParams, iend, dtlm);
- break;
- case ZSTD_dfast:
-- ZSTD_fillDoubleHashTable(ms, cParams, iend);
-+ ZSTD_fillDoubleHashTable(ms, cParams, iend, dtlm);
- break;
-
- case ZSTD_greedy:
-@@ -2256,7 +2259,12 @@ static size_t ZSTD_checkDictNCount(short* normalizedCounter, unsigned dictMaxSym
- * assumptions : magic number supposed already checked
- * dictSize supposed > 8
- */
--static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* dict, size_t dictSize, void* workspace)
-+static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs,
-+ ZSTD_matchState_t* ms,
-+ ZSTD_CCtx_params const* params,
-+ const void* dict, size_t dictSize,
-+ ZSTD_dictTableLoadMethod_e dtlm,
-+ void* workspace)
- {
- const BYTE* dictPtr = (const BYTE*)dict;
- const BYTE* const dictEnd = dictPtr + dictSize;
-@@ -2336,7 +2344,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_matc
- bs->entropy.offcode_repeatMode = FSE_repeat_valid;
- bs->entropy.matchlength_repeatMode = FSE_repeat_valid;
- bs->entropy.litlength_repeatMode = FSE_repeat_valid;
-- CHECK_F(ZSTD_loadDictionaryContent(ms, params, dictPtr, dictContentSize));
-+ CHECK_F(ZSTD_loadDictionaryContent(ms, params, dictPtr, dictContentSize, dtlm));
- return dictID;
- }
- }
-@@ -2347,6 +2355,7 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, ZS
- ZSTD_CCtx_params const* params,
- const void* dict, size_t dictSize,
- ZSTD_dictContentType_e dictContentType,
-+ ZSTD_dictTableLoadMethod_e dtlm,
- void* workspace)
- {
- DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize);
-@@ -2356,12 +2365,12 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, ZS
-
- /* dict restricted modes */
- if (dictContentType == ZSTD_dct_rawContent)
-- return ZSTD_loadDictionaryContent(ms, params, dict, dictSize);
-+ return ZSTD_loadDictionaryContent(ms, params, dict, dictSize, dtlm);
-
- if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {
- if (dictContentType == ZSTD_dct_auto) {
- DEBUGLOG(4, "raw content dictionary detected");
-- return ZSTD_loadDictionaryContent(ms, params, dict, dictSize);
-+ return ZSTD_loadDictionaryContent(ms, params, dict, dictSize, dtlm);
- }
- if (dictContentType == ZSTD_dct_fullDict)
- return ERROR(dictionary_wrong);
-@@ -2369,7 +2378,7 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, ZS
- }
-
- /* dict as full zstd dictionary */
-- return ZSTD_loadZstdDictionary(bs, ms, params, dict, dictSize, workspace);
-+ return ZSTD_loadZstdDictionary(bs, ms, params, dict, dictSize, dtlm, workspace);
- }
-
- /*! ZSTD_compressBegin_internal() :
-@@ -2377,6 +2386,7 @@ static size_t ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, ZS
- size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
- const void* dict, size_t dictSize,
- ZSTD_dictContentType_e dictContentType,
-+ ZSTD_dictTableLoadMethod_e dtlm,
- const ZSTD_CDict* cdict,
- ZSTD_CCtx_params params, U64 pledgedSrcSize,
- ZSTD_buffered_policy_e zbuff)
-@@ -2397,7 +2407,7 @@ size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
- {
- size_t const dictID = ZSTD_compress_insertDictionary(
- cctx->blockState.prevCBlock, &cctx->blockState.matchState,
-- ¶ms, dict, dictSize, dictContentType, cctx->entropyWorkspace);
-+ ¶ms, dict, dictSize, dictContentType, dtlm, cctx->entropyWorkspace);
- if (ZSTD_isError(dictID)) return dictID;
- assert(dictID <= (size_t)(U32)-1);
- cctx->dictID = (U32)dictID;
-@@ -2408,6 +2418,7 @@ size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
- size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
- const void* dict, size_t dictSize,
- ZSTD_dictContentType_e dictContentType,
-+ ZSTD_dictTableLoadMethod_e dtlm,
- const ZSTD_CDict* cdict,
- ZSTD_CCtx_params params,
- unsigned long long pledgedSrcSize)
-@@ -2416,7 +2427,7 @@ size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
- /* compression parameters verification and optimization */
- CHECK_F( ZSTD_checkCParams(params.cParams) );
- return ZSTD_compressBegin_internal(cctx,
-- dict, dictSize, dictContentType,
-+ dict, dictSize, dictContentType, dtlm,
- cdict,
- params, pledgedSrcSize,
- ZSTDb_not_buffered);
-@@ -2431,7 +2442,7 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx,
- ZSTD_CCtx_params const cctxParams =
- ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params);
- return ZSTD_compressBegin_advanced_internal(cctx,
-- dict, dictSize, ZSTD_dct_auto,
-+ dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast,
- NULL /*cdict*/,
- cctxParams, pledgedSrcSize);
- }
-@@ -2442,7 +2453,7 @@ size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t di
- ZSTD_CCtx_params const cctxParams =
- ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params);
- DEBUGLOG(4, "ZSTD_compressBegin_usingDict (dictSize=%u)", (U32)dictSize);
-- return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, NULL,
-+ return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL,
- cctxParams, ZSTD_CONTENTSIZE_UNKNOWN, ZSTDb_not_buffered);
- }
-
-@@ -2553,7 +2564,7 @@ size_t ZSTD_compress_advanced_internal(
- {
- DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)",
- (U32)srcSize);
-- CHECK_F( ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, NULL,
-+ CHECK_F( ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL,
- params, srcSize, ZSTDb_not_buffered) );
- return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize);
- }
-@@ -2654,7 +2665,7 @@ static size_t ZSTD_initCDict_internal(
- { size_t const dictID = ZSTD_compress_insertDictionary(
- &cdict->cBlockState, &cdict->matchState, ¶ms,
- cdict->dictContent, cdict->dictContentSize,
-- dictContentType, cdict->workspace);
-+ dictContentType, ZSTD_dtlm_full, cdict->workspace);
- if (ZSTD_isError(dictID)) return dictID;
- assert(dictID <= (size_t)(U32)-1);
- cdict->dictID = (U32)dictID;
-@@ -2799,7 +2810,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(
- }
- params.fParams = fParams;
- return ZSTD_compressBegin_internal(cctx,
-- NULL, 0, ZSTD_dct_auto,
-+ NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast,
- cdict,
- params, pledgedSrcSize,
- ZSTDb_not_buffered);
-@@ -2889,7 +2900,7 @@ static size_t ZSTD_resetCStream_internal(ZSTD_CStream* cctx,
- assert(!((dict) && (cdict))); /* either dict or cdict, not both */
-
- CHECK_F( ZSTD_compressBegin_internal(cctx,
-- dict, dictSize, dictContentType,
-+ dict, dictSize, dictContentType, ZSTD_dtlm_fast,
- cdict,
- params, pledgedSrcSize,
- ZSTDb_buffered) );
-diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h
-index 81f12ca6..0a19b3ec 100644
---- a/lib/compress/zstd_compress_internal.h
-+++ b/lib/compress/zstd_compress_internal.h
-@@ -235,6 +235,7 @@ struct ZSTD_CCtx_s {
- #endif
- };
-
-+typedef enum { ZSTD_dtlm_fast, ZSTD_dtlm_full } ZSTD_dictTableLoadMethod_e;
-
- typedef size_t (*ZSTD_blockCompressor) (
- ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
-@@ -640,7 +641,7 @@ MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window,
- * ============================================================== */
-
- /* ZSTD_getCParamsFromCCtxParams() :
-- * cParams are built depending on compressionLevel, src size hints,
-+ * cParams are built depending on compressionLevel, src size hints,
- * LDM and manually set compression parameters.
- */
- ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
-@@ -672,6 +673,7 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict);
- size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
- const void* dict, size_t dictSize,
- ZSTD_dictContentType_e dictContentType,
-+ ZSTD_dictTableLoadMethod_e dtlm,
- const ZSTD_CDict* cdict,
- ZSTD_CCtx_params params,
- unsigned long long pledgedSrcSize);
-diff --git a/lib/compress/zstd_double_fast.c b/lib/compress/zstd_double_fast.c
-index 86e6b396..a4feafbf 100644
---- a/lib/compress/zstd_double_fast.c
-+++ b/lib/compress/zstd_double_fast.c
-@@ -14,7 +14,7 @@
-
- void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
- ZSTD_compressionParameters const* cParams,
-- void const* end)
-+ void const* end, ZSTD_dictTableLoadMethod_e dtlm)
- {
- U32* const hashLarge = ms->hashTable;
- U32 const hBitsL = cParams->hashLog;
-@@ -40,6 +40,9 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
- hashSmall[smHash] = current + i;
- if (i == 0 || hashLarge[lgHash] == 0)
- hashLarge[lgHash] = current + i;
-+ /* Only load extra positions for ZSTD_dtlm_full */
-+ if (dtlm == ZSTD_dtlm_fast)
-+ break;
- }
- }
- }
-diff --git a/lib/compress/zstd_double_fast.h b/lib/compress/zstd_double_fast.h
-index 6d80b277..3f5a24eb 100644
---- a/lib/compress/zstd_double_fast.h
-+++ b/lib/compress/zstd_double_fast.h
-@@ -20,7 +20,7 @@ extern "C" {
-
- void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
- ZSTD_compressionParameters const* cParams,
-- void const* end);
-+ void const* end, ZSTD_dictTableLoadMethod_e dtlm);
- size_t ZSTD_compressBlock_doubleFast(
- ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
- ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
-diff --git a/lib/compress/zstd_fast.c b/lib/compress/zstd_fast.c
-index df4d28b3..22b84d1c 100644
---- a/lib/compress/zstd_fast.c
-+++ b/lib/compress/zstd_fast.c
-@@ -14,7 +14,7 @@
-
- void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
- ZSTD_compressionParameters const* cParams,
-- void const* end)
-+ void const* end, ZSTD_dictTableLoadMethod_e dtlm)
- {
- U32* const hashTable = ms->hashTable;
- U32 const hBits = cParams->hashLog;
-@@ -34,6 +34,9 @@ void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
- size_t const hash = ZSTD_hashPtr(ip + i, hBits, mls);
- if (i == 0 || hashTable[hash] == 0)
- hashTable[hash] = current + i;
-+ /* Only load extra positions for ZSTD_dtlm_full */
-+ if (dtlm == ZSTD_dtlm_fast)
-+ break;
- }
- }
- }
-diff --git a/lib/compress/zstd_fast.h b/lib/compress/zstd_fast.h
-index f0438ad5..746849fc 100644
---- a/lib/compress/zstd_fast.h
-+++ b/lib/compress/zstd_fast.h
-@@ -20,7 +20,7 @@ extern "C" {
-
- void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
- ZSTD_compressionParameters const* cParams,
-- void const* end);
-+ void const* end, ZSTD_dictTableLoadMethod_e dtlm);
- size_t ZSTD_compressBlock_fast(
- ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
- ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
-diff --git a/lib/compress/zstd_ldm.c b/lib/compress/zstd_ldm.c
-index bffd8a3d..9d825e69 100644
---- a/lib/compress/zstd_ldm.c
-+++ b/lib/compress/zstd_ldm.c
-@@ -224,12 +224,12 @@ static size_t ZSTD_ldm_fillFastTables(ZSTD_matchState_t* ms,
- switch(cParams->strategy)
- {
- case ZSTD_fast:
-- ZSTD_fillHashTable(ms, cParams, iend);
-+ ZSTD_fillHashTable(ms, cParams, iend, ZSTD_dtlm_fast);
- ms->nextToUpdate = (U32)(iend - ms->window.base);
- break;
-
- case ZSTD_dfast:
-- ZSTD_fillDoubleHashTable(ms, cParams, iend);
-+ ZSTD_fillDoubleHashTable(ms, cParams, iend, ZSTD_dtlm_fast);
- ms->nextToUpdate = (U32)(iend - ms->window.base);
- break;
-
-diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c
-index c7a205d8..62afdd6c 100644
---- a/lib/compress/zstdmt_compress.c
-+++ b/lib/compress/zstdmt_compress.c
-@@ -625,7 +625,7 @@ void ZSTDMT_compressionJob(void* jobDescription)
-
- /* init */
- if (job->cdict) {
-- size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dct_auto, job->cdict, jobParams, job->fullFrameSize);
-+ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast, job->cdict, jobParams, job->fullFrameSize);
- assert(job->firstJob); /* only allowed for first job */
- if (ZSTD_isError(initError)) { job->cSize = initError; goto _endJob; }
- } else { /* srcStart points at reloaded section */
-@@ -637,6 +637,7 @@ void ZSTDMT_compressionJob(void* jobDescription)
- } }
- { size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
- job->prefix.start, job->prefix.size, ZSTD_dct_rawContent, /* load dictionary in "content-only" mode (no header analysis) */
-+ ZSTD_dtlm_fast,
- NULL, /*cdict*/
- jobParams, pledgedSrcSize);
- if (ZSTD_isError(initError)) {
---
-2.17.0
-
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2018-07-03 10:05:48 UTC (rev 327924)
+++ PKGBUILD 2018-07-03 10:20:36 UTC (rev 327925)
@@ -4,7 +4,7 @@
# Contributor: Johan Förberg <johan at forberg.se>
pkgname=zstd
-pkgver=1.3.4
+pkgver=1.3.5
pkgrel=1
pkgdesc='Zstandard - Fast real-time compression algorithm'
arch=(x86_64)
@@ -13,13 +13,13 @@
depends=(zlib xz lz4)
makedepends=(gtest)
source=(zstd-$pkgver.tar.gz::https://github.com/facebook/zstd/archive/v${pkgver}.tar.gz
- 0001-Only-load-extra-table-positions-for-CDicts.patch)
-sha256sums=('92e41b6e8dd26bbd46248e8aa1d86f1551bc221a796277ae9362954f26d605a9'
- 'ca8469a21fe8b24d48d05e7e9f95d2bd79d9ca44b7b4a4e9d6ddab1a59832d9f')
+ zstd-1.3.5-fix-tests.patch)
+sha256sums=('d6e1559e4cdb7c4226767d4ddc990bff5f9aab77085ff0d0490c828b025e2eea'
+ '3c34c2aed193595559c1b3cb4503d81c73d3e21dcf8ab659b26aa917abcb194c')
prepare() {
cd $pkgname-$pkgver
- patch -p1 -i "$srcdir"/0001-Only-load-extra-table-positions-for-CDicts.patch
+ patch -p1 -i "$srcdir/zstd-1.3.5-fix-tests.patch"
}
build() {
@@ -32,7 +32,6 @@
check() {
cd $pkgname-$pkgver
make check
- make -C tests test-zstd
make -C contrib/pzstd test
}
Added: zstd-1.3.5-fix-tests.patch
===================================================================
--- zstd-1.3.5-fix-tests.patch (rev 0)
+++ zstd-1.3.5-fix-tests.patch 2018-07-03 10:20:36 UTC (rev 327925)
@@ -0,0 +1,97 @@
+From 712a9fd9721c314f4b0238577d803b012845f6d2 Mon Sep 17 00:00:00 2001
+From: "W. Felix Handte" <w at felixhandte.com>
+Date: Fri, 29 Jun 2018 15:33:44 -0400
+Subject: [PATCH] Allow Invoking `zstd --list` When `stdin` is not a `tty`
+
+Also now returns an error when no inputs are given.
+
+New proposed behavior:
+
+```
+felix at odin:~/prog/zstd (list-stdin-check)$ ./zstd -l; echo $?
+No files given
+1
+felix at odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst; echo $?
+Frames Skips Compressed Uncompressed Ratio Check Filename
+ 1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
+0
+felix at odin:~/prog/zstd (list-stdin-check)$ ./zstd -l <Makefile.zst; echo $?
+zstd: --list does not support reading from standard input
+No files given
+1
+felix at odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst <Makefile.zst; echo $?
+Frames Skips Compressed Uncompressed Ratio Check Filename
+ 1 0 3.08 KB 10.92 KB 3.544 XXH64 Makefile.zst
+0
+felix at odin:~/prog/zstd (list-stdin-check)$
+```
+---
+ programs/fileio.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/programs/fileio.c b/programs/fileio.c
+index 0175b3163..b4eed28d1 100644
+--- a/programs/fileio.c
++++ b/programs/fileio.c
+@@ -2017,21 +2017,25 @@ static int FIO_listFile(fileInfo_t* total, const char* inFileName, int displayLe
+ }
+
+ int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){
+-
+- if (!IS_CONSOLE(stdin)) {
+- DISPLAYOUT("zstd: --list does not support reading from standard input\n");
+- return 1;
++ unsigned u;
++ for (u=0; u<numFiles;u++) {
++ if (!strcmp (filenameTable[u], stdinmark)) {
++ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
++ return 1;
++ }
+ }
+
+ if (numFiles == 0) {
++ if (!IS_CONSOLE(stdin)) {
++ DISPLAYOUT("zstd: --list does not support reading from standard input\n");
++ }
+ DISPLAYOUT("No files given\n");
+- return 0;
++ return 1;
+ }
+ if (displayLevel <= 2) {
+ DISPLAYOUT("Frames Skips Compressed Uncompressed Ratio Check Filename\n");
+ }
+ { int error = 0;
+- unsigned u;
+ fileInfo_t total;
+ memset(&total, 0, sizeof(total));
+ total.usesCheck = 1;
+From 8e7bdc18d62632adcee029b2f8f5013d11549dd7 Mon Sep 17 00:00:00 2001
+From: "W. Felix Handte" <w at felixhandte.com>
+Date: Fri, 29 Jun 2018 16:31:22 -0400
+Subject: [PATCH] Fix Tests of `--list` Behavior with `stdin`
+
+---
+ tests/playTests.sh | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/tests/playTests.sh b/tests/playTests.sh
+index 09a7377f2..aa5535d59 100755
+--- a/tests/playTests.sh
++++ b/tests/playTests.sh
+@@ -731,8 +731,14 @@ $ECHO "\n===> zstd --list/-l error detection tests "
+ ! $ZSTD -lv tmp1*
+ ! $ZSTD --list -v tmp2 tmp12.zst
+
+-$ECHO "\n===> zstd --list/-l exits 1 when stdin is piped in"
+-! echo "piped STDIN" | $ZSTD --list
++$ECHO "\n===> zstd --list/-l errors when presented with stdin / no files"
++! $ZSTD -l
++! $ZSTD -l -
++! $ZSTD -l < tmp1.zst
++! $ZSTD -l - < tmp1.zst
++! $ZSTD -l - tmp1.zst
++! $ZSTD -l - tmp1.zst < tmp1.zst
++$ZSTD -l tmp1.zst < tmp1.zst # but doesn't error just because stdin is not a tty
+
+ $ECHO "\n===> zstd --list/-l test with null files "
+ ./datagen -g0 > tmp5
More information about the arch-commits
mailing list