Bug 232094 - Removing file from link folder doesn't uninstall bundles
Summary: Removing file from link folder doesn't uninstall bundles
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal with 3 votes (vote)
Target Milestone: 3.5 M3   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 233449 239427 245458 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-14 11:22 EDT by Simon Kaegi CLA
Modified: 2008-11-12 14:17 EST (History)
13 users (show)

See Also:


Attachments
work in progress (8.93 KB, patch)
2008-06-04 20:18 EDT, DJ Houghton CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Kaegi CLA 2008-05-14 11:22:33 EDT
When we remove an eclipse extension folder from the dropins folder the associated ius get uninstalled but the site still remains in the platform.xml file.

This is particularly bad for links since even if we remove the link file from the dropins but leave the contents pointed to by the link intact nothing gets uninstalled.
Comment 1 DJ Houghton CLA 2008-05-14 16:58:05 EDT
The first case is handled by bug 229408. 

The second case is particularly interesting. It means the link file was removed by the location that it pointed to is still around so when we try and reconcile the platform.xml we look and the site still exists so we think it is ok.

Essentially we want to remove any sites from the platform.xml file which aren't referenced anymore. This is harder to do with the new story.
Comment 2 Simon Kaegi CLA 2008-05-15 10:36:05 EDT
Updating the title a little to reflect that we now just have the problem with links.
Comment 3 Simon Kaegi CLA 2008-05-22 10:18:18 EDT
*** Bug 233449 has been marked as a duplicate of this bug. ***
Comment 4 DJ Houghton CLA 2008-06-04 10:39:14 EDT
One thing that I noticed is that when we have a site in the platform.xml that is resulting from a .link file, we do not set the linkFile attribute on the site object. See PlatformConfigurationWrapper#addFeatureEntry and #createSite.

Perhaps if we were able to let that attribute filter down, then later on when we are reading the sites in the PlatformXMLListener we would be able to check for the existence of the link file before doing the synchronization.
Comment 5 DJ Houghton CLA 2008-06-04 15:34:15 EDT
In the old update manager code, everything is easier because it is all centered around the platform configuration (platform.xml) file and a known location for extension location links files (/links). Essentially when the configuration initializes, it iterates over all the sites and checks to see if the link file still exists and if not, then it unconfigures and removes the site.

With p2, we have a profile synchronizer which takes a bunch of repositories (each link file in /links, multiple repositories for repos in /dropins, multiple repositories for other extensions as defined in the platform.xml file, etc) and tries to install as much as it can from all of the repos.

That being said, here are my thoughts:

- if the linkfile site attribute is already set on a site in the platform.xml file then we are golden... in the profile synchronizer when we are iterating over the sites we can check for this attribute and if it exists check to see if the file exists. if not, then just don't add the repo for that site which would cause things from that site to be uninstalled

- so the only case not handled now is the discovery of link files and ensuring the linkFile site attribute is set in the platform.xml file. This is a bit harder since we get the "install feature" command with a table of properties to use during installation. One thing that might work... in the DropinsRepositoryListener when we discover that we have a repo created from a link file, we could set a link file location property on that repo. Then if that property was set on all features which come from that repo, the property could be passed along through the install phase. Then later in the platform configuration wrapper when we create a new site object (because one doesn't exist for our new feature to install) we can add the linkFile site attribute if the property exists.

Just an initial thought. I'm not sure if we really want to put that attribute on all the features in the repo but I'm not sure if there is another way to map back from the feature to the repository it came from.
Comment 6 DJ Houghton CLA 2008-06-04 20:18:29 EDT
Created attachment 103676 [details]
work in progress

Here is a work in progress patch. Still doesn't work because when we go to remove the bundle from the configuration (ConfigData#removeBundle) the BundleInfo object that we are trying to remove from the set, isn't #equal to the one in the set.

Here is an example of the 2 different bundle info objects with the first one being in the configuration and the second one is the parameter to the #remove method:

BundleInfo(org.eclipse.core.resources.spysupport, 1.4.0.200607170928, location=file:C:\Documents and Settings\Administrator\Desktop\eclipse\plugins\org.eclipse.core.resources.spysupport_1.4.0.200607170928.jar, startLevel=4, toBeStarted=false, resolved=true, id=29,no manifest)

BundleInfo(org.eclipse.core.resources.spysupport, 1.4.0.200607170928, location=null, startLevel=-1, toBeStarted=false, resolved=false, id=-1,manifest available)

I will investigate this further, I just wanted to attach the patch so I wouldn't lose my progress.
Comment 7 Egidijus Vaisnora CLA 2008-06-05 06:54:27 EDT
I am confused a little if it is the same problem or not... My plugin is integrated with link files also and after
I remove link files from dropins, plugins still is started. Even, if I remove entries from platform.xml file and run with -clean property, it still exist. Only, when I remove entries from the "bundles.info" file, my plugin is gone. 

Eclipse build : I20080530-1730
OS: Mac OS 10.5.2
Comment 8 DJ Houghton CLA 2008-06-05 09:09:12 EDT
Yes, this is the same problem.
Comment 9 DJ Houghton CLA 2008-06-05 09:36:46 EDT
I should have said re: comment #6 that when in the debugger I hacked the variables so the bundles were actually removed from the configuration and everything was uninstalled as expected.
Comment 10 DJ Houghton CLA 2008-06-05 10:34:25 EDT
Not for 3.4.

The workaround (although a bit ugly), is to delete the link file, remove/rename the extension location, and start with -clean.
Comment 11 Jeff McAffer CLA 2008-06-05 14:27:32 EDT
does this need a readme entry or some such?
Comment 12 John Arthorne CLA 2008-07-03 14:36:12 EDT
*** Bug 239427 has been marked as a duplicate of this bug. ***
Comment 13 Jeff McAffer CLA 2008-08-28 01:14:11 EDT
*** Bug 245458 has been marked as a duplicate of this bug. ***
Comment 14 Michael Valenta CLA 2008-08-28 07:02:09 EDT
It also turns out that replacing a bundle in a linked folder with a newer version doesn't get picked up either, at least in 3.5 M1.
Comment 15 Youssef CLA 2008-10-05 08:03:35 EDT
I disparately need to fix that because we are using a nightly built plugin and I have to to setup the whole thing with other plugins just to update that ! 

Can you shed some light on how I can apply this patch to my current ganymede distro ? 
Which project/subproject to build , what jar to replace , ... 
Thanks 

Comment 16 DJ Houghton CLA 2008-10-08 16:17:44 EDT
Michael, your issue is covered by bug 222945.

The weird BundleInfo#equals behaviour is covered by bug 246432 and bug 247176.

Fix and regression test released to HEAD.

Closing.
Comment 17 Youssef CLA 2008-10-08 16:51:23 EDT
(In reply to comment #16)
> Michael, your issue is covered by bug 222945.
> 
> The weird BundleInfo#equals behaviour is covered by bug 246432 and bug 247176.
> 
> Fix and regression test released to HEAD.
> 
> Closing.
> 

Thanks That's great news. 
I see that target milestone is 3.5 M3 , Any change that this gonna be applied to ganymede as well ? 
Comment 18 DJ Houghton CLA 2008-10-08 17:05:06 EDT
Not right now. It is not currently on our list of issues to be addressed in the 3.4.2 maintenance branch.
Comment 19 Egidijus Vaisnora CLA 2008-11-12 06:51:01 EST
It is removed from platform.xml, but plugin still is available?  Build id: I20081030-1917
Comment 20 Pascal Rapicault CLA 2008-11-12 08:59:55 EST
Reopen to make sure this gets seen.
Comment 21 DJ Houghton CLA 2008-11-12 09:32:22 EST
Pascal, are you saying that you want this released to 3.4.2?
Comment 22 DJ Houghton CLA 2008-11-12 14:17:16 EST
I talked to Pascal and his intention for re-opening was so the comment on the bug was seen, not so that the fix be released into the maintenance branch.

Egidijus, I am unable to reproduce this problem. I did the following:
- unzip and start I20081030-1917 build and shutdown
- put an extension location in the dropins folder
- startup -> notice feature and bundles are installed
- shutdown
- delete the extension from the dropins folder
- startup -> notice feature and bundle are no longer installed
- also note that the platform.xml does not contain a site pointing to the dropins folder

We also have a regression test for this problem and it has been passing.

Please open a new bug report if you have a reproducible problem that we can look into. Thanks.