RFR: 8345431: Detect duplicate entries in jar files with jar --validate
Lance Andersen
lancea at openjdk.org
Fri Apr 4 16:47:07 UTC 2025
On Fri, 4 Apr 2025 16:12:56 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>> As we checking entry uniqueness and the size match, and all LOC entries should be in CEN, that would means all CEN entries in LOC.
>> But if we would like to be specific about the inconsistency, then we will have to do a little more work.
>
> Yes, in a perfect world there will be a 1 to 1 match but either way we should sanity check it in case something happened
> Is the ordering required by ZIP or Jar format? We can certainly do that if that's under spec and not an implementation detail.
The Zip Spec states the following:
> 4.3.2 Each file placed into a ZIP file MUST be preceded by a "local
> file header" record for that file. Each "local file header" MUST be
> accompanied by a corresponding "central directory header" record within
> the central directory section of the ZIP file.
That being said I am not aware of any implementations where the order is different given you have to generate the LOC prior to the CEN and End of CEN
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24430#discussion_r2029133374
More information about the core-libs-dev
mailing list