-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Describe the bug
In normal operation the - should be treated as stdin. When compressing multiple files and one of them is - the cli incorrectly attempts to make a file named stdin.zst and segfaults.
To Reproduce
zstd
cd $(mktemp -d)
echo oops > !
echo oh no > -
zstd ! -zstd: /*stdin*\.zst: Permission denied 280%
fish: Job 1, 'zstd *' terminated by signal SIGSEGV (Address boundary error)
-f makes no difference here and still a segfault
gzip
cd $(mktemp -d)
echo oops > !
echo oh no > -
gzip ! -gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
If zstd - ! is passed, zstd will propogate the stdin->stdout behavior to all other files.
cd $(mktemp -d)
echo oops > !
zstd - ! -fhello
(/X1hello
S(/$)oops
�5~⏎
however gzip does not propogate this behavior
cd $(mktemp -d)
echo oops > !
gzip - ! -fhello
lQ���� 0:6⏎
Expected behavior
zstd should print stdin is a console, aborting or if -f is passed, wait for standard input and write it to standard output in between doing the other file behaviors. This matches what gzip does.
Desktop
linux - zstd 1.5.2 built from source
Let me know thoughts a fix and I am happy to move forward with a PR.
Reactions are currently unavailable