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

Bug 315746

Summary: --launcher.openFile on Solaris fails with error about unresolved symbol sem_open
Product: [Eclipse Project] Equinox Reporter: Anton Leherbauer <aleherb+eclipse>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, Silenio_Quarti, tjwatson
Version: 3.6Flags: tjwatson: review+
Target Milestone: 3.6.1   
Hardware: Sun   
OS: Solaris-GTK   
Whiteboard:
Bug Depends on: 316938    
Bug Blocks: 316949, 322291    
Attachments:
Description Flags
patch
none
eclipse_1307.so binary none

Description Anton Leherbauer CLA 2010-06-04 05:52:24 EDT
3.6 RC3:

Trying to open a file using the --launcher.openFile option I am getting following error:

> eclipse --launcher.openFile myTextFile

ld.so.1: eclipse: fatal: relocation error: file /eclipse/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.0.v20100503/eclipse_1307.so: symbol sem_open: referenced symbol not found
Comment 1 Anton Leherbauer CLA 2010-06-04 06:20:36 EDT
Doing
> setenv LD_PRELOAD /lib/librt.so
fixes the error, but still no file is opened.
Comment 2 Thomas Watson CLA 2010-06-04 09:19:33 EDT
The openFile option is only currently only supported on win32, Linux GTK and Mac.
Comment 3 Andrew Niefer CLA 2010-06-04 14:41:28 EDT
I think it was intended to work on all GTKs, I'm not sure why it doesn't work for solaris (once the required library is loaded).  

I'm also surprised there aren't any link messages for this when compiling.
Comment 4 Andrew Niefer CLA 2010-06-04 15:16:00 EDT
Solaris doesn't like our semaphore name which is "SWT_Window_Eclipse" in my test.
I found this buried in the solaris man page:
     The name argument conforms to the construction
     rules for a pathname. The first character of  name must be a
     slash   (/)  character and the remaining characters of  name
     cannot include any slash characters.  For maximum  portabil-
     ity,   name  should  include no more than 14 characters, but
     this limit is not enforced.

These restrictions don't seem to exist on linux.

I'm not sure if we need to worry about the 14 character limit (we are over it), but we don't have the '/' character.
Comment 5 Andrew Niefer CLA 2010-06-04 15:44:53 EDT
Once the semaphore name is fixed everything appears to be working fine on the launcher side, but I'm not seeing the file opened in the UI.

Perhaps this really isn't supported on Solaris.

 Silenio, is SWT watching for the "org.eclipse.swt.filePath.message" property change on solaris?
Comment 6 Silenio Quarti CLA 2010-06-07 10:54:20 EDT
Yes, SWT is watching for the property change on all GTK platforms (solaris and linux). The name of the selection atom has to be 

"SWT_Window_" + APP_NAME

Is that changed as well?
Comment 7 Andrew Niefer CLA 2010-06-07 11:01:27 EDT
(In reply to comment #6)
> Yes, SWT is watching for the property change on all GTK platforms (solaris and
> linux). The name of the selection atom has to be 
> 
> "SWT_Window_" + APP_NAME
> 
> Is that changed as well?

I had to change things around a little to get a '/' mutex name but I was able to keep the "SWT_Window_" atom.   We were able to successfully find the window and change the filepath.message property on it.  I'll have to try debugging the java side to see what is happening there.
Comment 8 Andrew Niefer CLA 2010-06-14 18:05:45 EDT
Created attachment 171876 [details]
patch

Patch does the following so far:
1) link with librt.so
2) handle failure getting the semaphore, eclipse will start and not open the file instead of exiting.
3) Fix the semaphore name to start with '/'

With this patch, everything appears to be working correctly in the launcher.  However, I am still not seeing files get opened.  Something must be wrong on the Java side.
Comment 9 Andrew Niefer CLA 2010-06-14 18:08:55 EDT
Created attachment 171877 [details]
eclipse_1307.so binary

Here is a binary compiled with the above patch and an additional debug printf statement.  
It will print
org.eclipse.swt.filePath.message=/path/to/file.txt:

to the console when it successfully writes the file path to the property on the SWT window.  When this is printed, everything succeeded as far as the launcher is concerned.
Comment 10 Andrew Niefer CLA 2010-06-15 12:05:52 EDT
Silenio and I found a problem in SWT, I raised bug 316938
Comment 11 Andrew Niefer CLA 2010-06-15 13:27:07 EDT
We can look at this patch for 3.6.1
Comment 12 Thomas Watson CLA 2010-08-10 14:20:43 EDT
+1 for 3.6.1.
Comment 13 Andrew Niefer CLA 2010-08-10 15:47:05 EDT
patch released to branch