-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 command-line tool should accept options from the environment #1423
Comments
This is debatable. Given that we have no strong scenario where environment variables are needed, but we already know this feature caused security risks in the past, we prefer to not go into this direction. |
Understood, but this implies that GNU tar should not receive a short-hand switch to compress as .tar.zst, like -z for gzip, -j for .tar.bz2 and -J for .tar.xz. Compression should always be done with a pipeline or by using |
You mean, in order to pass a specific compression level since the short-hand will only use the default one ? I believe we could consider supporting an environment variable limited to compression level only. |
What about using a dictionary when decompressing a tar archive? |
This is not recommended. Dictionaries are effective when shared across a lot of small data. A tar archive is like a single big stream of bytes. Dictionary efficiency will be underwhelming, since it will save a few KB, which is likely a tiny amount compared to the archive. On the other hand, the requirement to have the dictionary available at decompression time will be a deployment challenge. |
Hi @Cyan4973, thanks for the great work around here. What about setting the number of parallel threads used for compression? I see you opted for environment variables that are limited to a specific argument. Could you add a new one for the number of threads, say BTW, |
You are right. It has been recently added to the
That could be an interesting option. Our concerns is that environment arguments can be used to silently alter program behavior, potentially leading to some form of denial, such as resource exhaustion. When it comes to multithreading, the memory budget is basically multiplied by the number of threads. 2 threads is unlikely to be more dangerous than one, but what about 200 ? I believe that if we can have a good answer to this risk, it could unlock this candidate feature. |
Good to know it is already documented and thanks for the detailed reply. Unfortunately I am unable to provide a good answer to the "risk" you mention because I do not perceive it as a risk. It seems to me that you are trying to protect the user from himself. If something else but the user is setting such environment variable, then he probably has much greater concerns other than resource exhaustion. Silently altering zstd behaviour is precisely what I would like to have, in order to be able to use it comfortably from tar, as can be done with other compression programs. As is, I have to use zstd is a command line tool, meaning it is mostly used by professionals or enthusiasts. Like many other professional tools, it can do bad things, but only if you use it improperly. That's why we have manuals. Limiting the flexibility of a professional tool in order to make it just a little less dangerous to the novice (that doesn't care to read the manual) is a tradeoff that I am not fond of. Summing up, IMHO it would suffice to add a warning to the manual stating that multi-threading will lead to memory exhaustion. Anyway, as an half-baked measure to do damage control to the unwary user, instead of |
Like gzip with $GZIP and xz with $XZ_OPT . Quoting xz's manpage:
The text was updated successfully, but these errors were encountered: