When cache subsystem is enabled, "Failed to run decoder step: Bad message" will occur in some situations during extract.
This error happens because entry_offset check fails in function: ca_decoder_parse_filename ( cadecode.c [line 2643] ). Also, If cache subsystem is disabled, the check will success.
Here is a simplified example of my case, support tow chunks will generated.
test/
test1/
1.txt
2.txt
"entry of test", "test1", "1.txt", "goodbye of test1" will in chunk1;
2.txt and goodbye data of test will in chunk2.
First time, without cache:
casync make --cache=casync_cache --with=permissions --with=sec-time --with=symlinks --chunk-size=1048576 1.caidx test -v
Second time, we append a character ‘a’ in the 1.txt. Then make 2.caidx with cache:
casync make --cache=casync_cache --with=permissions --with=sec-time --with=symlinks --chunk-size=1048576 2.caidx test -v
Third time, make 3.caidx without cache :
casync make --with=permissions --with=sec-time --with=symlinks --chunk-size=1048576 3.caidx test -v
In the ideal situation. 2.caidx and 3.caidx should be the same.
But In this case, the second chunk in 2.caidx and 3.caidx differs. This means chunk2 should not be check out in cache subsystem.
The main reason is that:
In cache subsystem, CaLocation is used to check out cache, but function ca_location_equal(calocation.c) is not sufficient.
In our case: when we modidy 1.txt, the mtime of test1 changes. But mtime of test will not change. So the second chunk(contains googdbye data of test and has entry_offset) will finally check out.
But since 1.txt changes, the entry_offset in "goodbye data of test" should change. So If we check out this cached chunk, during extracting, entry_offset check happens.
To quickly fix this problem, I just use tow simply solutions.
let ca_location_equal return FALSE when a chunk contains goodbye data
delete entry_offset check during extract
Will there be any patches for this problem in the future? @poettering
When cache subsystem is enabled, "Failed to run decoder step: Bad message" will occur in some situations during extract.
This error happens because entry_offset check fails in function: ca_decoder_parse_filename ( cadecode.c [line 2643] ). Also, If cache subsystem is disabled, the check will success.
Here is a simplified example of my case, support tow chunks will generated.
"entry of test", "test1", "1.txt", "goodbye of test1" will in chunk1; 2.txt and goodbye data of test will in chunk2.
First time, without cache:
casync make --cache=casync_cache --with=permissions --with=sec-time --with=symlinks --chunk-size=1048576 1.caidx test -v
Second time, we append a character ‘a’ in the 1.txt. Then make 2.caidx with cache:
casync make --cache=casync_cache --with=permissions --with=sec-time --with=symlinks --chunk-size=1048576 2.caidx test -v
Third time, make 3.caidx without cache :
In the ideal situation. 2.caidx and 3.caidx should be the same.
But In this case, the second chunk in 2.caidx and 3.caidx differs. This means chunk2 should not be check out in cache subsystem.
The main reason is that:
In cache subsystem, CaLocation is used to check out cache, but function ca_location_equal(calocation.c) is not sufficient.
In our case: when we modidy 1.txt, the mtime of test1 changes. But mtime of test will not change. So the second chunk(contains googdbye data of test and has entry_offset) will finally check out.
But since 1.txt changes, the entry_offset in "goodbye data of test" should change. So If we check out this cached chunk, during extracting, entry_offset check happens.
To quickly fix this problem, I just use tow simply solutions.
Will there be any patches for this problem in the future? @poettering