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

Bug 342542

Summary: [shared] Help->Software Updates does not work when eclipse is started from a Windows UNC shortcut
Product: [Eclipse Project] Equinox Reporter: Sam Mising name <smithsj>
Component: p2Assignee: DJ Houghton <dj.houghton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pascal, pwebster, remy.suen, simon_kaegi
Version: 3.4.2   
Target Milestone: 3.4.2+   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
TXT file containing stack trace information
none
patch none

Description Sam Mising name CLA 2011-04-12 07:12:43 EDT
Build Identifier: 3.4.2.201102071137

When you start eclipse that is installed on a remote system from a Windows shortcut (e.g. \\hostname\sharename\path\executable), a stack trace is logged.

The platform appears to start just fine, however, when you click Help->Software Updates then another stack trace is logged and the Updates window is not shown.

I'll add the stack traces as an attachment. 

If I map the network drive and start it from there (e.g. z:\executable) then things appear to work just fine. 



Reproducible: Always

Steps to Reproduce:
1. Install eclipse in a shared directory on a remote windows machine 
2. Create a desktop shortcut which specifies to start it from the remote location e.g. \\hostname\pathname\directory\executable
3. Startup the platform and the error should occur. Clicking Help->Software updates also logs an exception and no updates panel is shown.
Comment 1 Sam Mising name CLA 2011-04-12 07:14:28 EDT
Created attachment 193028 [details]
TXT file containing stack trace information

Here's a text file containing stack trace information, many thanks.
Comment 2 DJ Houghton CLA 2011-04-12 16:06:42 EDT
We've successfully started Eclipse 3.4.2 both on WinXP and Win7 from a UNC path. Is there more information that you can provide about your setup that might help us determine/reproduce the problem?
Comment 3 Pascal Rapicault CLA 2011-04-12 21:43:01 EDT
Also how are we doing on 3.7?
Comment 4 Sam Mising name CLA 2011-04-13 06:06:21 EDT
Hi there,
Thanks so much for trying this out for me.  I can reproduce the problem when my eclipse is installed onto a remote Windows system.  The Drive is shared as read-only and eclipse is installed in a directory called O:\eclipse.

So on my local client which is Windows XP, I then right-click the desktop and select New->Shortcut.  In the 'Create Shortbut' wizard, I then type in '\\hostname\sharename\' and then Windows seems to search and so 'eclipse' comes up as an autosuggest option so I select that and then the eclipse.exe.  I give it a name and click Finish. 

Then I right click on the newly created shortcut and select Properties. In the Properties dialog, in the Target property, I add in the -consoleLog option so that I can see any errors that are logged on startup and click OK to save the change.

Then I double click the link and eclipse starts with a DOS console window. In there, I see several exceptions, the first of which starts: 
!MESSAGE Plug-in "org.eclipse.equinox.p2.ui.sdk" was unable to instantiate class
 "org.eclipse.equinox.internal.p2.ui.sdk.AutomaticUpdateScheduler".
!STACK 0
java.lang.IllegalStateException: Registry Directory not available.
        at org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry.restore(
SimpleProfileRegistry.java:330)
....

Then, if I click the Help->Software Updates... menu item then nothing happens but the exception is again logged in my console window. 

Please let me know if there's anything else that I can do to help.
Many thanks.
Comment 5 DJ Houghton CLA 2011-04-20 10:55:42 EDT
What type of file system/OS is the remote one?
Comment 6 Sam Mising name CLA 2011-04-20 11:28:05 EDT
The remote OS is a Windows Server 2003 machine and the drive is formatted as NTFS.
The drive is also configured as read-only. 
Interestingly, I've just tried changing that to give write permissions to the user and the problem does not occur.
I don't think that this solution is acceptable to our customer who is trying to manage a shared installation where all users access the same drive.
It might provide a clue as to where to look though?
Does eclipse need write access to the directory that it's installed into?
Comment 7 DJ Houghton CLA 2011-04-26 11:31:53 EDT
What are the System property values that you see when you go into "Help -> About -> Configuration Details" for the following properties:

eclipse.p2.data.area
osgi.configuration.area
Comment 8 DJ Houghton CLA 2011-04-26 13:27:05 EDT
From my testing this works OK in 3.7.

In 3.4.2, the code in SimpleProfileRegistry#restore is calling java.io.File#isDirectory which is returning false for a read-only folder .

We have the same code in 3.7 but registry seems to be constructed in a different manner and is pointing to the user's local config area (which is writable) so we don't see the error.
Comment 9 DJ Houghton CLA 2011-04-28 11:40:55 EDT
Simon, this is the bug that I was talking about. The code in and around SurrogateProfileHandler is causing us problems in 3.4.2.
Comment 10 DJ Houghton CLA 2011-06-27 17:08:38 EDT
As suspected, this has to do with a subtle problem when converting URLs representing UNC paths to Files. 

We have a URL which is similar to: 
file://machine/share/r342/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry

We then call new File(url.getPath()). This path isn't considered absolute so File pre-pends extra data to it so the absolute path of what we end up with is actually:
\\machine\share\r342\eclipse\share\r342\eclipse\p2\org.eclipse.equinox.p2.engine\profileRegistry

The code is in SurrogateProfileHandler#getProfileRegistry.
Comment 11 DJ Houghton CLA 2011-06-28 10:45:44 EDT
Created attachment 198739 [details]
patch

Here is a patch. In 3.7 we use the URI class to handle some path issues. I've copied parts of our URIUtil class from equinox.common and called the same code as in 3.7.
Comment 12 DJ Houghton CLA 2011-06-28 11:00:21 EDT
Patch released to R34x maintenance branch.