Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327822

Summary: [tools] JarComparator reports "The feature has a different number of entries" for identical feature jars during p2 mirroring
Product: [Eclipse Project] Equinox Reporter: Frode Meling <fmeling>
Component: p2Assignee: Ian Bull <irbull>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: henrik.lindberg, pascal, tonny.madsen
Version: 3.6.1   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: stalebug

Description Frode Meling CLA 2010-10-14 15:11:08 EDT
Build Identifier: M20100909-0800

org.eclipse.equinox.p2.internal.repository.comparator.JarComparator reports that two (binary) identical feature jars has "different numbers of entries".

Caused by org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry not considering its "os", "ws" and "arch" attributes in its equals() and hashCode() methods.

The following entries in the org.eclipse.rcp feature are thus considered equal:

    <plugin
         id="org.eclipse.swt.cocoa.macosx"
         os="macosx"
         ws="cocoa"
         arch="ppc"
         download-size="0"
         install-size="0"
         version="3.6.1.v3655c"
         fragment="true"
         unpack="false"/>
         
    <plugin
         id="org.eclipse.swt.cocoa.macosx"
         os="macosx"
         ws="cocoa"
         arch="x86"
         download-size="0"
         install-size="0"
         version="3.6.1.v3655c"
         fragment="true"
         unpack="false"/>

Putting these into a Map<FeatureEntry,FeatureEntry> in JarComparator "looses" the first entry.

If the code is modified to use a string key (e.g. id_version_os_ws_arch) in the map makes the JarComparator works as expected.

Reproducible: Always

Steps to Reproduce:
p2.mirror org.eclipse.rcp feature into a composite repository that contains the the binary identical feature from a previous build.
Comment 1 Pascal Rapicault CLA 2010-12-23 22:54:12 EST
Hi Frode, sorry for the late reply. Would you mind providing a patch? Thx.
Assigning to Ian since he owns this part of the code.
Comment 2 Ian Bull CLA 2011-05-05 18:54:34 EDT
I'm not sure I 'own' the jar compressor, but if you have a patch I'd be happy to review it.
Comment 3 Eclipse Genie CLA 2019-08-26 13:21:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.