Community
Participate
Working Groups
Creating a file in place of a linked resources, then deleting that linked resource from the .project file leaves the workspace in an inconsistent state. Reproducibility steps: 1) create a new project "p1" 2) create a new folder under "p1/dir" in Eclipse 3) create a new file "foo.c" in Windows Explorer, under the "p1" folder (c:\wksp\p1\foo.c for example) 4) drag and drop foo.c from Windows Explorer under "p1/dir" in the Eclipse Workbench 5) click ok to create a linked file 6) Edit the newly created p1/dir/foo.c linked resource, and change its location to PROJECT_LOC\dir\foo.c 6) In Windows Explorer, move p1\foo.c to p1\dir\foo.c 7) close p1 in the Eclipse Workbench 8) open p1/.project in notepad, and remove the following lines: <linkedResources> <link> <name>dir/foo.c</name> <type>1</type> <locationURI>PROJECT_LOC/dir/foo.c</locationURI> </link> </linkedResources> 9) Go back to Eclipse, and open the project p1. 10) Refresh the project. 11) Notice that the resource p1/dir/foo.c is still a linked resource : this is a bug. 12) Right click on the resource p1/dir/foo.c, and notice that a) The 'Type' is Linked File - this is a bug b) The location is '<resource does not exist> - this is a bug.
Created attachment 204577 [details] Fix Fix for this issue. The approach is to have this bug resolved when the user refreshes the workspace.
Szymon, can you review this patch for me please? Thanks.
I think we may reproduce using easier steps: 1) Create a project 'p1' 2) Create a linke file under 'p1' and link it to anything 3) Close the project and remove <linkedResources> section from .project 4) Open the project and refresh The linked file is still there. If just do: 1) Create a project 'p1' 2) Create a linke file under 'p1' and link it to anything 3) Remove <linkedResources> section from .project 4) Refresh .project The linked resource will be removed. I think that the problem is Project#reconcileLinksAndGroups? I'll check if I am right. Serge, could you attach a test?
These steps fail too: 1) Create a project 'p1' 2) Create a linked file under 'p1' and link it to anything 3) Close Eclipse and remove <linkedResources> section from .project 4) Restart Eclipse and refresh 'p1' Looking closer at #reconcileLinksAndGroups, it indeed does not do a good job for failing cases described in this bug. If linked resources were removed from .project while the project was closed, #reconcileLinksAndGroups will not remove them from the workspace.
setting target to 3.8M5
(In reply to comment #4) > These steps fail too: > 1) Create a project 'p1' > 2) Create a linked file under 'p1' and link it to anything > 3) Close Eclipse and remove <linkedResources> section from .project > 4) Restart Eclipse and refresh 'p1' > > Looking closer at #reconcileLinksAndGroups, it indeed does not do a good job > for failing cases described in this bug. If linked resources were removed from > .project while the project was closed, #reconcileLinksAndGroups will not remove > them from the workspace. How can #reconcileLinksAndGroups get the list of linked resources in the workspace, and validate them against the description.getLinks() list without a visitor? It seems like adding a visitor in #reconcileLinksAndGroups would be more of a performance issue than the current fix in the RefreshLocalVisitor, what do you think?
Sege, still in the plan for M6? We do not have much time.
your suggestion looks good Szymon, I'll get back to you tomorrow with a fix.
Created attachment 215072 [details] Fix and JUnit test Here's a new fix moving the resolution to the reconcile() code instead of in the RefreshVisitor code.
Created attachment 215073 [details] Fix and JUnit test Again, but with less spurious changes.
(In reply to comment #10) > Created attachment 215073 [details] > Fix and JUnit test > > Again, but with less spurious changes. I'm not sure where the line changes are comming from, since I verified twice I only changed the reconcileLinksAndGroups() method in Project.java. The diff is misleading in terms of how much change there is. To summarize it, this was the old implementation: reconcileLinksAndGroups() { // old code } The new implementation looks like that: reconcileLinksAndGroups() { try { // old code } finally { // new code } } Szymon, can you review the changes please? thanks.
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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.