"File size mismatch when reading from pack" error when files are actually not corrupt

Description

Problem:
We are getting "File size mismatch when reading from pack: <filename here>" for multiple files during installation but the files in the Pack are actually not corrupt (and the installation actually works fine if we tweak the resources/packs.info file from the generated jar). The error does not occur with 5.1.2.

Possible cause:
Commit https://github.com/izpack/izpack/commit/fc97c51110c771e6b98ca78d21d56c13485bc346 introduced some checks that do not work correctly when a file from another pack within the same jar is referenced during unpacking (com.izforge.izpack.api.data.PackFile#isBackReference is true). That is because the PackFile object and its linked PackFile object have different sizes.

Possible solution:
One option is to check the linked file size in the CompressedFileUnpacker (if the file is a back reference). Another option is to copy the linkedPackFile size back to the packFile size in com.izforge.izpack.compiler.packager.impl.Packager#writePacks

Thanks for looking into this. Let me know if I can provide some additional information to help.

Environment

None

Status

Assignee

Unassigned

Reporter

Marvin Fiori

Impact

Functional - may break existing environments

Components

Affects versions

Priority

Medium
Configure