-
Notifications
You must be signed in to change notification settings - Fork 40
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
Better handling of error when dealing with an unknown compression #66
Comments
Small improvement: diff --git a/src/thread_comp.c b/src/thread_comp.c
index 7e2ce01..fafe8e7 100644
--- a/src/thread_comp.c
+++ b/src/thread_comp.c
@@ -39,6 +39,7 @@
#include "thread_comp.h"
#include "error.h"
#include "queue.h"
+#include "archinfo.h"
int compress_block_generic(struct s_blockinfo *blkinfo)
{
@@ -99,7 +100,7 @@ int compress_block_generic(struct s_blockinfo *blkinfo)
#endif // OPTION_ZSTD_SUPPORT
default:
free(bufcomp);
- msgprintf(2, "invalid compression level: %d\n", (int)compalgo);
+ msgprintf(2, "unsupported compression algorithm: %s\n", compalgostr(compalgo));
return -1;
}
@@ -274,7 +275,7 @@ int decompress_block_generic(struct s_blockinfo *blkinfo)
break;
#endif // OPTION_ZSTD_SUPPORT
default:
- errprintf("unsupported compression algorithm: %ld\n", (long)blkinfo->blkcompalgo);
+ errprintf("unsupported compression algorithm: %s\n", compalgostr(blkinfo->blkcompalgo));
return -1;
}
free(blkinfo->blkdata); // free old buffer (with compressed data)
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what hapenned :
Restoring a backup make with lz4 compression with an older release fail in a non intuitive way. It will simply stall indefinitely, with no error message, and require to kill the program.
how to reproduce :
thread_comp.c#243,decompress_block_generic(): unsupported compression algorithm: 7
comment :
Here, clearly, the user is at fault. fsarchiver 0.8.3 will default to the new algorithm and this conflicted with the older program but it's still a user fault. they (I) just need to use the newer version to do the restore.
I don't ask to patch all older version of the program, that's impossible.
However, if you could modify the current version of the program to handle this case more gracefully, that would be great.
If in the future a new compression is added, this issue would be more clear than what is currently is.
possible improvement could be :
if there is an error when uncompressing a file,
if that's not possible, it's not that big of a deal. you don't add new compression algorithm quite often hehe.
The text was updated successfully, but these errors were encountered: