-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zstd willing to (try to) compress non-files #232
Comments
Indeed, good point. I guess this falls outside of standard C, |
Some more detail :
but it does not detect such issue behind a pipe : So it makes the issue easier to deal with. For information, current version of |
The reason This is now made clearer in latest "dev" branch update, since it will print a more explicit message. Therefore, Note however that This is a surprise. Not sure if this should be considered a feature to imitate or a bug... |
With v0.7.2 out, Instead of : that is, compression will not happen because it's not possible to create destination file, and not because That being said, I've been surprised to note that both Anyway, we are now in a situation where Is it considered good enough ? |
gzip and xz are stat'ing the file to determine its type, and refusing if it isn't a file. When processing as a stream, they can't tell the source of bytes is a device, so they simply have to compress it. For devices, FIFOs, unix domain sockets, and other file-like-but-not-quite-file objects, they can refuse. Basically they are refusing when they can tell and otherwise doing what they must -- consume input bytes from an already opened file descriptor. |
Yes, when However, in the following example, it seems to be provided as a regular File System object :
Only the output is redirected, not the input. |
That may be intentional but the behavior is probably not practically useful. The logic is perhaps "don't compress if input isn't a file and output is" under the premise the output could get terminated by whatever is consuming the pipe. It seems pretty sketchy, but it makes sense for fifos, sockets, etc, even when the output directory is writable. xz basically checks the output type. Looks like behavior emulated to be consistent (mostly) with gzip and bzip2. |
Latest |
* dev: updated NEWS fixed MSAN warnings in legacy decoders Fix cmake build updated NEWS Edits as per comments, and change wildcard 'X' to '?' Fix Visual Studios project Fix pool.c threading.h import Fix zstdmt_compress.h include Fixed commented issues Updated format specification to be easier to understand improved facebook#232 fix Fixed facebook#232 .travis.yml: different tests for "master" branch .travis.yml: optimized order of short tests .travis.yml: test jobs 12-15 JOB_NUMBER -eq 9 improved ZSTD_compressBlock_opt_extDict_generic
Is there any good reason to disable compressing on non-files? There's no point in artifically preventing this, and in some cases it can be useful (eg. compressing an entire device image). There's not even a flag to re-enable this functionality, the only current workaround is to pass the input through a pipe, consuming extra CPU. Could be nice functionality to implement for some edge use-cases. |
@negamartin you should be able to use |
Seems like it only works with links: running EDIT: Even when running with root privileges. |
This was recently changed in |
Thank you! I'm sorry, I didn't find that issue. |
gzip refuses to compress files that aren't "normal" such as devices, fifos, sockets, symlinks, etc. zstd tries to compress them anyway, which can lead to odd behavior such as hanging when it's a fifo, reading forever when it's
/dev/zero
, etc etc.The text was updated successfully, but these errors were encountered: