Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mrdis
Copy link

@mrdis mrdis commented Oct 17, 2025

Previous version was not checking uncompressed data digests if available, leading to being unable to reuse chunks compressed with different zstd versions, which lead to different compressed data and different compressed data digests.

@mrdis
Copy link
Author

mrdis commented Oct 17, 2025

I see errors in windows compilations, but they are not related to the new code... maybe a compiler update now treating implicit function declarations as errors?

Copy link
Member

@jdieter jdieter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggestions to restructure the logic on this. Can you please take a look and tell me what you think?

HASH_FIND(hh, src_info->ht, tgt_idx->digest, tgt_idx->digest_size, f);
if(f && f->length == tgt_idx->length &&
f->comp_length == tgt_idx->comp_length)
/* If both archives has uncompressed data digests, check them instead of the compressed ones */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my preference here is to first check that the compression types are identical, and, if so, run HASH_FIND. If f is still NULL (either because the compression types weren't identical or because HASH_FIND didn't find a matching hash), then check if both have uncompressed sources, and if so, run HASH_FIND on the uncompressed sources. This ensures that matching compressed hashes are checked first, and we then only check for matching uncompressed sources if no matches were found.

}

/*
* Compare digest for compressed data if the same compressor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make the above change, is this full change necessary? Maybe it's better to just duplicate the logic I suggested above?

ALLOCD_BOOL(NULL, b);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to have spaces/tabs in empty lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants