-
Notifications
You must be signed in to change notification settings - Fork 152
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
Report unsupported compression in solv_xfopen() with errno #563
Report unsupported compression in solv_xfopen() with errno #563
Conversation
Is ENOTSUP available everywhere? I.e. on BSD and windows (MSVC)? (You can also use solv_xfopen_iscompressed() to figure out if the compression is supported: it returns 0 if the file is not compressed, 1 if it is compressed and the compression is supported, or -1 if the compression is not supported.) |
I have no idea. Do people process YUM repositories on BSD or Windows? |
ENOTSUP is documented in POSIX 2017 https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html. |
Yes. But also this is not YUM-only. |
Ok. I will add a #ifdef guard. |
84e3503
to
7a80f35
Compare
Now the code should compile even if ENOTSUP is not available. |
I think if it's in POSIX we don't need the guard. If somebody complains that it's missing for some specific OS, we can add a
at the beginning... |
If libsolv was built without Zstandard support and "primary.xml.zst" was passed solv_xfopen(), solv_xfopen() returned 0 without setting errno. A calling application could not distinguish an unsupported compression format from other I/O errors. This patch improves this situation by setting errno variable to an appropriate value. The value macros are documented in POSIX 2017.
7a80f35
to
fee6928
Compare
I removed the guards. |
Thanks! |
If libsolv was built without Zstandard support and "primary.xml.zst" was passed solv_xfopen(), solv_xfopen() returned 0 without setting errno. A calling application could not distinguish an unsupported compression format from other I/O errors.
This patch improves this situation by setting errno variable to an appropriate value.