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

Bug 362246

Summary: Platform.launch doesn't work on gio only systems.
Product: [Eclipse Project] Platform Reporter: Alexander Kurtakov <akurtakov>
Component: SWTAssignee: Alexander Kurtakov <akurtakov>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: critical    
Priority: P3 CC: arunkumar.thondapu, gheorghe
Version: 3.7   
Target Milestone: 3.8 M4   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
The patch none

Description Alexander Kurtakov CLA 2011-10-27 17:59:43 EDT
Currently gio_launch uses g_file_new_for_path function but it works for local paths only and fails for remote (http://, ftp:// and etc.). The correct function to use is g_file_new_for_commandline_arg which handles both local and remote paths/uris.
This can't be reproduced on systems that have gnome_vfs because launch function will fallback to gnome_24_launch.
The attached patch is against master but it would be nice to be backported for Indigo SR2 because there are more and more systems that miss libgnome(and friends). This bug was identified because of azureus/vuze failing to start on the soon to be released Fedora 16 because it uses Program.launch("http://....).
Comment 1 Alexander Kurtakov CLA 2011-10-27 18:00:19 EDT
Created attachment 206099 [details]
The patch
Comment 2 Alexander Kurtakov CLA 2011-10-27 18:01:05 EDT
There is a public git_repo available to ease future merges. The commit is http://fedorapeople.org/gitweb?p=akurtakov/public_git/eclipse.platform.swt.git;a=commitdiff;h=804ccbc5af46d99e0a5fe26da847914a9b2a7ecf
Comment 3 Silenio Quarti CLA 2011-11-16 14:24:58 EST
Patch is good. Thanks Alex.

Does it make sense to call g_file_new_for_commandline_arg() in Program.gio_execute() as well?


Fixed
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=413c9491a928162b65715cf4be7506ad03721c18
Comment 4 Alexander Kurtakov CLA 2011-11-17 04:27:44 EST
(In reply to comment #3)
> Patch is good. Thanks Alex.
> 
> Does it make sense to call g_file_new_for_commandline_arg() in
> Program.gio_execute() as well?
> 
In Program.gio_execute there is check for local/remote and using the g_file_new_for_[uri|path]

Probably this can be simplified to a single call with g_file_new_for_commandline_arg but the current implementation is just fine because there is a check whether the app in question can load from uris and acting appropriately. FWIW, not much would be gained by doing that.
Comment 5 Alexander Kurtakov CLA 2011-11-17 04:41:22 EST
My last comment was not clear enough. 
Not much would be gained by using g_file_new_for_commandline_arg because there should be found another way to distinguish the case when an app doesn't support uris but an uri is given, i.e. reshuffling the code for no obvious win.
Comment 6 Silenio Quarti CLA 2011-11-18 09:21:46 EST
Hi Alex, thanks for the explanation. I understand the code in launch is not broken. The only reason one would change it is to make the code consistent between launch and execute, but it is ok to leave it the way it is.