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

Bug 518303

Summary: Oxygen forgets its persistent state
Product: [Eclipse Project] Platform Reporter: Olivier Croquette <ocroquette>
Component: IDEAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: bsd, Lars.Vogel, sravankumarl
Version: 4.7   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Olivier Croquette CLA 2017-06-15 08:17:09 EDT
I am using Eclipse 4.7RC2 I20170524-2000 on my Mac (Sierra). I have the problem that pretty often, Eclipse forgets the persistent state of my installation and acts as it were a new installation when I (re)start it. It forgets the workspaces  I used so far, and asks to (re)import the plugins I use.
This might be MacOS specific. I don't know how to troubleshoot this issue, but I would be happy to provide more information if I am told what.
Comment 1 Olivier Croquette CLA 2017-06-15 08:53:41 EDT
Related to 507328 and 461670
Comment 2 Olivier Croquette CLA 2017-06-15 08:55:35 EDT
Seems related to bug 507328 and bug 461670
Comment 3 Lars Vogel CLA 2017-06-15 09:22:56 EDT
Can't reproduce on Linux. Brian, can you reproduce?
Comment 4 Olivier Croquette CLA 2017-06-15 09:37:10 EDT
Thank(In reply to Lars Vogel from comment #3)
> Can't reproduce on Linux. Brian, can you reproduce?

Thanks for the feedback Lars. In the meantime I found out this is clearly MacOS specific. See bug 507328 comment 15.
Any MacOS user who currently uses the RC should be aware of this.

*** This bug has been marked as a duplicate of bug 507328 ***
Comment 5 Brian de Alwis CLA 2017-06-15 09:40:22 EDT
You shouldn't encounter the problem if you download the DMG.
Comment 6 Olivier Croquette CLA 2017-06-15 09:48:50 EDT
(In reply to Brian de Alwis from comment #5)
> You shouldn't encounter the problem if you download the DMG.

Thanks Brian, I didn't try it, but I assume that will work. However, the MacOS app is, at some locations, available in other forms, like here as .tar.gz:

http://download.eclipse.org/eclipse/downloads/drops4/S-4.7M5-201701261030/

Any user who downloads this kind of file is likely to run into trouble. If possible, it would be better to provide DMG files everywhere, but on top of that, I think that detecting the problem at runtime is a good idea, if, for instance, Apple decides to change the rules when the translocation is activated, or if for instance a user creates its own ZIP or TGZ file to transfer the application. See bug 507328 comment 15.
Comment 7 Lars Vogel CLA 2017-06-15 10:27:25 EDT
Sravan, should we stop distributing the .gz file?
Comment 8 Olivier Croquette CLA 2017-06-21 16:50:08 EDT
(In reply to Brian de Alwis from comment #5)
> You shouldn't encounter the problem if you download the DMG.

Hi Brian,

I tried this again, I downloaded the following file:

http://download.eclipse.org/eclipse/downloads/drops4/S-4.7RC4a-201706120950/download.php?dropFile=eclipse-SDK-4.7RC4a-macosx-cocoa-x86_64.dmg

I mounted the DMG, then copied the .app file to my desktop, and started it.

Obviously, the App Translocation was active, since the Target Platform (in the preferences) pointed to /private/var/folders/...

Then I ran:

$ if xattr -r Eclipse.app/ | grep com.apple.quarantine > /dev/null ; then echo "File is in quarantine" ; else echo "File is OK" ; fi
File is in quarantine

$ xattr -r -d com.apple.quarantine Eclipse.app/

$ if xattr -r Eclipse.app/ | grep com.apple.quarantine > /dev/null ; then echo "File is in quarantine" ; else echo "File is OK" ; fi
File is OK

Then I started Eclipse, and the Target Platform was at the expected location ($HOME/Desktop/...).

So it looks like copying the .app from the DMG to the local file system is not enough to avoid the problem. Removing the "com.apple.quarantine" attribute manually is necessary.

I am running macOS 10.12.3 (16D32)
Comment 9 Brian de Alwis CLA 2017-06-22 10:15:09 EDT
That's odd, as I tried the same thing and have no quarantine markers:

  $ codesign —verify --verbose /d1/e4/baselines/eclipse-SDK-4.7RC4a-macosx-cocoa-x86_64.dmg
  /d1/e4/baselines/eclipse-SDK-4.7RC4a-macosx-cocoa-x86_64.dmg: valid on disk
  /d1/e4/baselines/eclipse-SDK-4.7RC4a-macosx-cocoa-x86_64.dmg: satisfies its Designated Requirement

  [mount dmg on /Volumes/Eclipse]
  $ open /d1/e4/baselines/eclipse-SDK-4.7RC4a-macosx-cocoa-x86_64.dmg
  $ cd /Volumes/Eclipse/
  $ xattr -r Eclipse.app

and there are no attributes on any of the contents.

When I copy Eclipse to my desktop and launch it, the Target Platform points to the /Users/bsd/Desktop/Eclipse.app/Contents/Eclipse/, as expected.

This is on macOS 10.12.5.  Dunno if there's some change between 10.12.3 that would affect this.
Comment 10 Olivier Croquette CLA 2017-06-22 14:36:42 EDT
(In reply to Brian de Alwis from comment #9)
>   $ cd /Volumes/Eclipse/
>   $ xattr -r Eclipse.app
> and there are no attributes on any of the contents.

I don't have any attributes either on the app file in the mounted DMG, they appear only when I copy it.


> This is on macOS 10.12.5.  Dunno if there's some change between 10.12.3 that
> would affect this.

I found the difference. I use "Path Finder" as an more powerful alternative to the Finder (https://cocoatech.com/). If I copy the app with the Finder, it's fine, if I copy it with Path Finder, I have the problem.

Maybe this could be fixed by the Path Finder developers, but there are clearly other scenarios where the attributes would be set, for instance if a user packages it to transfer it to himself or a colleague. The current solution is very fragile,  I think that Eclipse should detect the situation and at least display a warning, or, at best, heal itself. Any idea on how/where to implement this at best? I could give it a try.
Comment 11 Brian de Alwis CLA 2017-06-22 14:48:08 EDT
Ah, nice find.  Note that Eclipse is not the only application that suffers under this new security mechanism so the developers of Path Finder will need to fix this.  I hope you'll report it ti them.

My guess is that it might be best done in the launcher code (C/C++); the xattr(1) page lists a few library calls for listing attributes.  But you might be able to get something up and going quickly in Java by using the org.eclipse.ui.startup extension point.  At the very worst, you can shell out to xattr.  The Eclipse launcher binary, if used, should be available from the System "eclipse.launcher" property:

  eclipse.launcher=/usr/local/installs/e4-dev/Eclipse.app/Contents/MacOS/eclipse

I'm closing this as WORKSFORME since it does work with the OS-provided tools.