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

Bug 350142

Summary: Feature requirements not respected when installing patch
Product: [Eclipse Project] Equinox Reporter: DJ Houghton <dj.houghton>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, irbull, leberre, pascal.rapicault, pascal
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug
Attachments:
Description Flags
patch-test none

Description DJ Houghton CLA 2011-06-23 10:01:40 EDT
Created attachment 198467 [details]
patch-test

build 3.7

I created a patch for a specific version range of a feature, but that range is not respected and p2 still allows the patch to try to be installed. 

For instance, here we specify a patch for the RCP feature but only versions [1,2). If you try to install this into Eclipse 3.7, it allows to you continue. I'll attach this example.

    <unit id='rcp.patch.feature.group' version='1.0.0' singleton='false'>
      <patchScope>
        <scope>
          <requires size='1'>
            <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.rcp.feature.group' range='[1.0.0,2.0.0)'/>
          </requires>
        </scope>
      </patchScope>
Comment 1 DJ Houghton CLA 2011-06-23 10:21:08 EDT
Adding Pascal and Daniel to the CC list. Does this mean we aren't encoding the feature version range correctly?
Comment 2 DJ Houghton CLA 2011-06-23 10:26:49 EDT
Note, these are the operands that I'm seeing being created when I'm trying to install the above patch into Eclipse 3.7. I would expect it to fail based on the requirement from the rcp.patch.feature.group IU to org.eclipse.rcp.feature.group [1.0,2.0).

null --> [R]rcp.patch.feature.group 1.0.0
null --> [R]rcp.patch.feature.jar 1.0.0
[IInstallableUnit property for rcp.patch.feature.group 1.0.0] org.eclipse.equinox.p2.internal.inclusion.rules = null --> OPTIONAL
[IInstallableUnit property for rcp.patch.feature.group 1.0.0] org.eclipse.equinox.p2.type.root = null --> true
Comment 3 Daniel Le Berre CLA 2011-06-23 10:38:04 EDT
Hi DJ,

I won't be able to take a look at it before next week.

I think that the problem is probably not the range but the way we encode patch.
Comment 4 DJ Houghton CLA 2011-06-23 10:56:47 EDT
Ok, thanks Daniel.
Comment 5 Pascal Rapicault CLA 2011-06-23 21:27:57 EDT
This bug seems to be a duplicate of bug #252897.
However just to be precise, what controls when the patch gets applied is the lifecycle section the IU:
  <lifeCycle>
    <required namespace='org.eclipse.equinox.p2.iu' name='org.eclipse.rcp.feature.group' range='0.0.0' greedy='false'/>
  </lifeCycle>

The applicability scope is supposed to limit the IU to which the patch is applied (e.g. all the IUs across all the system or just a few), and a quick search in the code indicates that it is not being used at all, but we will have to be careful because I think it used to be that the scope was being merged with other things like general requirements when read from the repo and it was how we would get it to work.

I'm leaving the bug open to continue the conversation on the goal to be achieved
Comment 6 Daniel Le Berre CLA 2011-06-24 13:52:06 EDT
I will take a look at the original bug report.
Comment 7 Ian Bull CLA 2012-06-11 14:36:15 EDT
I'll bump this to kepler so it doesn't get lost.  I would like to find some resolution though.
Comment 8 Eclipse Genie CLA 2019-08-28 15:24:50 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.