From c4a40dbf650ec7137b7548ff55c3d85477e043b0 Mon Sep 17 00:00:00 2001 From: cev Date: Sat, 27 Apr 2019 19:06:29 -0400 Subject: [PATCH 1/2] set followLinks option true to cat, zcat and gzcat programs --- programs/zstdcli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/zstdcli.c b/programs/zstdcli.c index fbb1c048a..c0dd925ce 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -588,11 +588,11 @@ int main(int argCount, const char* argv[]) /* preset behaviors */ if (exeNameMatch(programName, ZSTD_ZSTDMT)) nbWorkers=0, singleThread=0; if (exeNameMatch(programName, ZSTD_UNZSTD)) operation=zom_decompress; - if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(prefs); outFileName=stdoutmark; g_displayLevel=1; } /* supports multiple formats */ - if (exeNameMatch(programName, ZSTD_ZCAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(prefs); outFileName=stdoutmark; g_displayLevel=1; } /* behave like zcat, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* supports multiple formats */ + if (exeNameMatch(programName, ZSTD_ZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* behave like zcat, also supports multiple formats */ if (exeNameMatch(programName, ZSTD_GZ)) { suffix = GZ_EXTENSION; FIO_setCompressionType(prefs, FIO_gzipCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like gzip */ if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; FIO_setRemoveSrcFile(prefs, 1); } /* behave like gunzip, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; forceStdout=1; FIO_overwriteMode(prefs); outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat, also supports multiple formats */ if (exeNameMatch(programName, ZSTD_LZMA)) { suffix = LZMA_EXTENSION; FIO_setCompressionType(prefs, FIO_lzmaCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like lzma */ if (exeNameMatch(programName, ZSTD_UNLZMA)) { operation=zom_decompress; FIO_setCompressionType(prefs, FIO_lzmaCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like unlzma, also supports multiple formats */ if (exeNameMatch(programName, ZSTD_XZ)) { suffix = XZ_EXTENSION; FIO_setCompressionType(prefs, FIO_xzCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like xz */ From 3e1e49d7752fae634df1690185718ee1a1ebb0d6 Mon Sep 17 00:00:00 2001 From: cev Date: Mon, 29 Apr 2019 18:47:47 -0400 Subject: [PATCH 2/2] add test for zstdcat and zcat on symlink --- tests/playTests.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/playTests.sh b/tests/playTests.sh index bce271015..e139f7ad8 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -304,12 +304,17 @@ $ECHO "testing zstdcat symlink" ln -sf $ZSTD zstdcat ./zstdcat helloworld.zstd > result.tmp $DIFF helloworld.tmp result.tmp +ln -s helloworld.zstd helloworld.link.zstd +./zstdcat helloworld.link.zstd > result.tmp +$DIFF helloworld.tmp result.tmp rm zstdcat rm result.tmp $ECHO "testing zcat symlink" ln -sf $ZSTD zcat ./zcat helloworld.zstd > result.tmp $DIFF helloworld.tmp result.tmp +./zcat helloworld.link.zstd > result.tmp +$DIFF helloworld.tmp result.tmp rm zcat rm ./*.tmp ./*.zstd $ECHO "frame concatenation tests completed"