Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322821 - Error importing a read-only project on Windows when linked resource exists as a case variant
Summary: Error importing a read-only project on Windows when linked resource exists as...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 177148 338010
Blocks:
  Show dependency tree
 
Reported: 2010-08-16 13:11 EDT by Martin Oberhuber CLA
Modified: 2019-12-03 19:48 EST (History)
5 users (show)

See Also:


Attachments
Sample project to reproduce the issue (1.46 KB, application/x-zip-compressed)
2010-08-16 13:11 EDT, Martin Oberhuber CLA
no flags Details
Screenshot of the error dialog (7.73 KB, image/gif)
2010-08-16 13:13 EDT, Martin Oberhuber CLA
no flags Details
Simple patch for the problem (2.22 KB, patch)
2010-08-16 14:12 EDT, Martin Oberhuber CLA
no flags Details | Diff
Simple patch for the problem - checks for null (2.60 KB, patch)
2010-08-17 06:14 EDT, Serge Beauchamp CLA
no flags Details | Diff
My proposal v1 (2.77 KB, patch)
2011-03-30 05:18 EDT, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2010-08-16 13:11:48 EDT
Created attachment 176702 [details]
Sample project to reproduce the issue

CQ:WIND00207330 
Build ID: Eclipse 3.5.x as well as Helios (3.6.0)

When importing a read-only project into Workbench, an error occurs when:

- The project links in other resources
- The linked folder exists, but differs in case (e.g. D:\SW vs D:\sw)

This is an annoying problem when the .project file is version-controlled, so the CM system insists on making the file writable just to change the case of the linked file. 

Steps to reproduce:
1. Extract attached SW.zip into D:\
2. Launch Eclipse, File > Import > General : Existing Projects into Workspace
3. Root dir: Browse to D:\SW\proj
4. Press Finish

--> An error dialog pops up: "Error processing changed links in the project description file: File /testProj/.project is read-only".

Expected behavior: On Windows host, Eclipse should not report an error. It should not be necessary to make the .project file writeable just to resolve case difference.
Comment 1 Martin Oberhuber CLA 2010-08-16 13:13:36 EDT
Created attachment 176703 [details]
Screenshot of the error dialog
Comment 2 Martin Oberhuber CLA 2010-08-16 13:49:28 EDT
The problem seems to be line 667 in Resource.java:

   localLocation = FileUtil.canonicalURI(localLocation);

making the link location canonical makes sense when the link had not existed in the project description before. But I cannot see how this makes sense when the project description is just being read... on a case-insensitive file system (or even a file system that has symbolic links), the contents of the project description should win over what happens to be found on the local file system, since it is often team-shared and must be seen as the correct representation of the project.
Comment 3 Martin Oberhuber CLA 2010-08-16 14:12:36 EDT
Created attachment 176710 [details]
Simple patch for the problem

Attached is a simple patch for the problem: In case the link is already known to the project description, we skip the step of "canonicalizing" the link and the project description wins.

This solves the concrete problem at hand; but further pondering the situation, I'm wondering why the link location is "canonicalized" in the first place. It seems to be wrong doing so at a place that's supposed just to be data storage (clients could canonicalize themselves if they desire to).

The only reason that I can think of is dealing with cases where multiple linked resources point to the same link target (aliasing). Will ponder this a bit more, and see how the resources unittests go. What do others think?
Comment 4 Serge Beauchamp CLA 2010-08-17 06:14:14 EDT
Created attachment 176771 [details]
Simple patch for the problem - checks for null

I updated the patch to handle NPE when links are created.
Comment 5 Martin Oberhuber CLA 2011-03-10 05:52:43 EST
We should finally commit this into M7, bug 202727 might be related.

Can anybody take this, I'm currently dying from other non-eclipse workload.
Comment 6 Szymon Brandys CLA 2011-03-14 05:08:22 EDT
(In reply to comment #5)
> We should finally commit this into M7, bug 202727 might be related.
> 
> Can anybody take this, I'm currently dying from other non-eclipse workload.

I can see at least two volunteers. Either Serge, or the one who set the target milestone :-) Both are committers. Of course tests should be added along with the patch.
Comment 7 Szymon Brandys CLA 2011-03-30 05:18:00 EDT
Created attachment 192167 [details]
My proposal v1
Comment 8 Szymon Brandys CLA 2011-04-04 07:40:49 EDT
We will fix it once bug 338010 is fixed.
Comment 9 Szymon Brandys CLA 2012-04-25 11:25:35 EDT
We most likely will not address these bugs during this dev cycle.
Comment 10 Szymon Brandys CLA 2015-04-01 09:50:06 EDT
I am no longer involved in Platform Core development.
Comment 11 Eclipse Genie CLA 2019-12-03 19:48:20 EST
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.