-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Describe the bug
When trying to use the decompression passed through functionality on files of 0, 1, or 2 bytes the decompressor fails to read enough bytes to understand the context and quits instead of just copying the bytes to the output. This means if you have small files and are trying to use zstdcat for all of them, the very small files will fail and not be written to the output.
To Reproduce
echo | zstd -df
echo 1 | zstd -df
echo 12 | zstd -df
echo 123 | zstd -dfecho | zstdcat
echo 1 | zstdcat
echo 12 | zstdcat
echo 123 | zstdcatoutput
zstd: /*stdin*\: unknown header
zstd: /*stdin*\: unknown header
zstd: /*stdin*\: unknown header
123
Expected behavior
Zstd and gzip support decompression passthrough where the bytes will simply be copied to the output as-is when the following conditions are met:
- if a file is present that is not in a known format
- the
-fflag is present - the output will be written to stdout
example
❯ echo hello there | zstd -df
hello theregzip on the failure cases produces the correct output
echo | gzip -df
echo 1 | gzip -df
echo 12 | gzip -df
echo 123 | gzip -df
1
12
123
Screenshots and charts
Linux x86 - self installed from repo
Reactions are currently unavailable