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

Bug 344977

Summary: Unable to update fresh M7 install
Product: [Eclipse Project] Equinox Reporter: Andrew Niefer <aniefer>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: david_williams, dean.t.roberts, kim.moir, Olivier_Thomann, pwebster
Version: 3.7Flags: aniefer: review+
Target Milestone: 3.7 RC1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix dean.t.roberts: review?

Description Andrew Niefer CLA 2011-05-06 10:38:50 EDT
On linux x86_64, 
I downloaded a fresh 3.7M7 and extracted it to a writable directory. Start it and add the I-Build site http://download.eclipse.org/eclipse/updates/3.7-I-builds

Check for updates

An update 3.7.0.I20110505-0800 is available but can not be installed, the message says "Insufficient access privileges to apply this update."

I have all the access I need to apply this update, everything is writable in the normal layout.
Comment 1 Andrew Niefer CLA 2011-05-06 11:02:54 EDT
In the M7 download, before it is even run, the latest profile contains the following:

<iuProperties id='org.eclipse.sdk.ide' version='3.7.0.I20110428-0848'>
  <properties size='3'>
    <property name='org.eclipse.equinox.p2.internal.inclusion.rules' value='STRICT'/>
    <property name='org.eclipse.equinox.p2.type.lock' value='1'/>
    <property name='org.eclipse.equinox.p2.type.root' value='true'/>
  </properties>
</iuProperties>


If I remove the org.eclipse.equinox.p2.type.lock property before running, then I can update the install.
Comment 2 Andrew Niefer CLA 2011-05-06 11:08:22 EDT
Actually, looking at 
IProfile#LOCK_UNINSTALL = 1 << 0;
IProfile#LOCK_UPDATE = 1 << 1;
the profile property is fine, it is locked from uninstall.

The code AvailableUpdateElement#init is incorrect, it is only checking that the IProfile#PROP_PROFILE_LOCKED_IU property exists.  It should probably be checking that it equals IProfile#LOCK_UPDATE
Comment 3 Andrew Niefer CLA 2011-05-06 11:19:06 EDT
This is a problem for all platforms.  The uninstall property was introduced with bug 340791
Comment 4 Dean Roberts CLA 2011-05-06 12:02:37 EDT
Created attachment 194955 [details]
Fix

This was caused by a bug I introduced when implementing bug 344977.

I was testing for any lock.  In fact, I should only test for an update lock, not an uninstall lock.

This only surfaced recently when uninstall locks where added to the SDK profiles.
Comment 5 Andrew Niefer CLA 2011-05-06 14:01:19 EDT
I have released the patch with a small modification to catch NumberFormatException.

To test, I took a fresh M7.  Attempted to do the update and got the error.
Then I took p2.ui and applied the patch and exported into host.  After restart I tried the update again and it succeeded.
Comment 6 John Arthorne CLA 2011-05-06 15:43:29 EDT
In case anyone wants to workaround it manually, go to:

eclipse\p2\org.eclipse.equinox.p2.engine\profileRegistry\SDKProfile.profile

- Edit the most recent profile file
- Find the section in comment #1
- Remove the line:

    <property name='org.eclipse.equinox.p2.type.lock' value='1'/>

- Now start Eclipse and update it
Comment 7 Olivier Thomann CLA 2011-05-06 16:20:02 EDT
(In reply to comment #6)
> In case anyone wants to workaround it manually, go to:
> 
> eclipse\p2\org.eclipse.equinox.p2.engine\profileRegistry\SDKProfile.profile
> 
> - Edit the most recent profile file
> - Find the section in comment #1
> - Remove the line:
> 
>     <property name='org.eclipse.equinox.p2.type.lock' value='1'/>
> 
> - Now start Eclipse and update it
I think you also have to adjust the:
      <properties size='3'>
to:
      <properties size='2'>

This doesn't seem to be an issue with 4.1 I-build.
Comment 8 Andrew Niefer CLA 2011-05-06 16:24:28 EDT
The problem described in comment #4 exists in the 4.1 SDK, but 4.1 does not contain the uninstall lock introduced by bug 340791 so you are not prevented from updating.
Comment 9 Kim Moir CLA 2011-05-09 15:30:57 EDT
Verified that I could update the SDK from I20110507-0800 to I20110509-1200.