When I run windows binary of zstd v.1.4.0 or higher:
.\zstd.exe .\file.txt -D .\dictName
I get an error:
zstd: cannot use .\file.txt as an input file and dictionary
But when I use zstd 1.3.8 everything goes great:
.\zstd.exe .\file.txt -D .\dictName
.\file.txt : 3.75% (671180 => 25144 bytes, .\file.txt.zst)
could it be an issue of / vs \ ?
no, without slashes I get the same result:
C:\Users\user\Desktop>zstd.exe file.txt -D dictName -19
zstd: cannot use file.txt as an input file and dictionary
but zstd v1.3.8 works great:
C:\Users\user\Desktop>zstd138.exe file.txt -D dictName -19
file.txt : 2.45% (671180 => 16418 bytes, file.txt.zst)
So, it seems that a recent protection, preventing to use the same file as both the input and the dictionary, is kicking in on the Windows binary.
Indeed, that's weird, and something to fix.
Issue reproduced, using mingw64 on Windows 10 + msys2
I was surprised that this issue, which can be reproduced locally, did not show up during CI tests.
It appears that CI tests on Windows are limited to compilation test, they don't have a runtime session afterwards.
This should be updated, it would have make it possible to detect this issue earlier.
Strangely enough, runtime tests on Windows are supposed to be enabled, albeit with Visual binaries :
https://github.com/facebook/zstd/blob/dev/appveyor.yml#L166
And I'm positive that this used to work.
But it's unclear why they do no longer run recently...
_Edit_ : OK, these tests run, but only when reaching master, which means just before a release. Also, they are only active for Visual builds (while the pre-compiled binary is using mingw64).
Issue fixed in latest dev branch update