From 5b45ff4f1cd511a0bfba9ff28c8d73e03d9be4bd Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 25 Oct 2019 11:32:38 -0700 Subject: [PATCH 1/6] Gating named file support on windows --- programs/fileio.c | 12 ++++++++++++ programs/zstdcli.c | 14 ++++++++++++++ tests/playTests.sh | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/programs/fileio.c b/programs/fileio.c index d45e4bbda..20868b9b8 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -513,12 +513,24 @@ static FILE* FIO_openSrcFile(const char* srcFileName) return NULL; } +#ifdef _MSC_VER + + if (!UTIL_isRegularFile(srcFileName)) { + DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", + srcFileName); + return NULL; + } + +#else + if (!UTIL_isRegularFile(srcFileName) && !UTIL_isFIFO(srcFileName)) { DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", srcFileName); return NULL; } +#endif /* _MSC_VER */ + { FILE* const f = fopen(srcFileName, "rb"); if (f == NULL) DISPLAYLEVEL(1, "zstd: %s: %s \n", srcFileName, strerror(errno)); diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 7a0fa6a25..66b7ae5d2 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -992,11 +992,25 @@ int main(int argCount, const char* argv[]) if (!followLinks) { unsigned u; for (u=0, fileNamesNb=0; u 0) CLEAN_RETURN(1); diff --git a/tests/playTests.sh b/tests/playTests.sh index 29ac1faa5..036318a54 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -1080,6 +1080,8 @@ test -f dictionary rm -f tmp* dictionary +if [ "$isWindows" = false ] ; then + println "\n===> zstd fifo named pipe test " head -c 10 /dev/zero > tmp_original mkfifo named_pipe @@ -1090,4 +1092,6 @@ $DIFF -s tmp_original tmp_decompressed rm -rf tmp* rm -rf named_pipe +fi + rm -f tmp* From 8adecc73b0b9c01450c842b222491cfeacf5e308 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 25 Oct 2019 12:04:54 -0700 Subject: [PATCH 2/6] Running playtests.sh on PRs too --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 87fa5c12d..3a4803363 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -264,5 +264,6 @@ - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - if [%HOST%]==[mingw] ( set "CC=%COMPILER%" && - make check + make check && + sh -e playTests.sh --test-large-data ) From 0b52d878b27b320a6398048db094794bac15b83a Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 25 Oct 2019 14:06:50 -0700 Subject: [PATCH 3/6] Cleaning up gate and adding comment to flag --- programs/fileio.c | 22 ++++++++-------------- programs/util.c | 4 +++- programs/zstdcli.c | 26 ++++++++------------------ 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index 20868b9b8..48b6cb483 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -513,23 +513,17 @@ static FILE* FIO_openSrcFile(const char* srcFileName) return NULL; } -#ifdef _MSC_VER - if (!UTIL_isRegularFile(srcFileName)) { - DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", - srcFileName); - return NULL; - } - -#else - - if (!UTIL_isRegularFile(srcFileName) && !UTIL_isFIFO(srcFileName)) { - DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", - srcFileName); - return NULL; - } + if (!UTIL_isRegularFile(srcFileName) +#ifndef _MSC_VER + && !UTIL_isFIFO(srcFileName) #endif /* _MSC_VER */ + ) { + DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", + srcFileName); + return NULL; + } { FILE* const f = fopen(srcFileName, "rb"); if (f == NULL) diff --git a/programs/util.c b/programs/util.c index 5f97b1cde..54aca5b55 100644 --- a/programs/util.c +++ b/programs/util.c @@ -115,6 +115,8 @@ int UTIL_isSameFile(const char* file1, const char* file2) #endif } +#ifndef _MSC_VER +/* Using this to distinguish named pipes */ U32 UTIL_isFIFO(const char* infilename) { /* macro guards, as defined in : https://linux.die.net/man/2/lstat */ @@ -126,7 +128,7 @@ U32 UTIL_isFIFO(const char* infilename) (void)infilename; return 0; } - +#endif U32 UTIL_isLink(const char* infilename) { diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 66b7ae5d2..fe77be22e 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -992,25 +992,15 @@ int main(int argCount, const char* argv[]) if (!followLinks) { unsigned u; for (u=0, fileNamesNb=0; u 0) CLEAN_RETURN(1); From 857268b32c8efb99f1f40fab3534850f3871f007 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 25 Oct 2019 15:15:28 -0700 Subject: [PATCH 4/6] Gating named pipe support in hedaer file --- programs/util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/programs/util.h b/programs/util.h index 3b15d9471..e79834693 100644 --- a/programs/util.h +++ b/programs/util.h @@ -135,7 +135,10 @@ U32 UTIL_isDirectory(const char* infilename); int UTIL_getFileStat(const char* infilename, stat_t* statbuf); int UTIL_isSameFile(const char* file1, const char* file2); +#ifndef _MSC_VER U32 UTIL_isFIFO(const char* infilename); +#endif + U32 UTIL_isLink(const char* infilename); #define UTIL_FILESIZE_UNKNOWN ((U64)(-1)) U64 UTIL_getFileSize(const char* infilename); From 66f580ca73451dd8114a0c7ab43944ec7b6fe30e Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Mon, 28 Oct 2019 22:09:34 -0700 Subject: [PATCH 5/6] Removing Visual08 and Visual10 tests --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3a4803363..9958c882d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -173,8 +173,6 @@ sh -e playTests.sh --test-large-data && fullbench.exe -i1 && fullbench.exe -i1 -P0 && - fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% && - fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% From 4a9eca4b9d40631e87b37a8e31a6a410f3bd6af0 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Tue, 29 Oct 2019 09:45:28 -0700 Subject: [PATCH 6/6] Removing merge side effect --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9958c882d..dd2c02ac4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -262,6 +262,5 @@ - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - if [%HOST%]==[mingw] ( set "CC=%COMPILER%" && - make check && - sh -e playTests.sh --test-large-data + make check )