Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356853 - PDE launcher deletes EVERY FILE in HOME DIR (and potentially on DISK) if configuration directory changed
Summary: PDE launcher deletes EVERY FILE in HOME DIR (and potentially on DISK) if conf...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 critical (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 352808
Blocks:
  Show dependency tree
 
Reported: 2011-09-06 15:34 EDT by Eric Estievenart CLA
Modified: 2011-12-06 17:43 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Estievenart CLA 2011-09-06 15:34:04 EDT
Build Identifier: 20110615-0604

trying to change the storage path for a pde runtime configuration makes
the RCP launcher delete all files in a wrong folder (e.g. home folder).



Reproducible: Always

Steps to Reproduce:
*** BEWARE DO NOT TRY TO REPRODUCE WITH A USER WHICH HAS ALL RIGHTS ON WHOLE FILESYSTEMS ***

1. Create a new user on your system, ensure it has only access on a reduced part of your disks
(e.g. do not attempt to run on a fat32 filesystem. last warning!)
2. create some files/folders on the home dir just to verify they will disappear
3. launch eclipse (RCP/RAP build)
4. new / plugin project
   project name: rcp
   create rich client appication: yes
   template: "Hello RCP"
   finish
5. launch it once: right-click on project; run as eclipse app
6. open run configurations, and edit the last run config:
   in configuration tab,
     - uncheck "Use default location"
     - and set location to:
        ${workspace_loc}/rcp/config
     - check "Clear configuration area before launching"
7. click apply
at that point the home folder looks like:
$tree -d ~
├── Desktop
├── NEW_FOLDER
│   └── F2
└── WS
    └── rcp
        ├── bin
        │   └── rcp
        ├── icons
        ├── META-INF
        └── src
            └── rcp

8. click run
  => eclipse says "Failed to launch..."
java.lang.RuntimeException: Application "rcp.application" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
	at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
	at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

9. now list the home folder again:
$tree -d ~
/tmp/etesthome
├── org.eclipse.core.runtime
├── org.eclipse.equinox.app
├── org.eclipse.osgi
├── org.eclipse.update
└── WS

===> THE WHOLE HOME FOLDER HAS BEEN SCRAPPED
Comment 1 Eric Estievenart CLA 2011-09-06 15:53:07 EDT
Note: after reopening the workspace,
it seems that the config location was stored as empty in the preference page...
Comment 2 Curtis Windatt CLA 2011-09-06 17:18:25 EDT
Probably related to Bug 352808.  The configuration area is not stored correctly.  If this problem is also rooted in the changed on bug 309701, we will have to revert those changes in both 3.8 and 3.7.2.
Comment 3 Michael Rennie CLA 2011-09-07 11:41:39 EDT
(In reply to comment #2)
> Probably related to Bug 352808.  The configuration area is not stored
> correctly.  If this problem is also rooted in the changed on bug 309701, we
> will have to revert those changes in both 3.8 and 3.7.2.

Using the steps provided I do not get the home directory being deleted and my stacktrace is slightly different:

java.io.FileNotFoundException: /eclipse/eclipse/org.eclipse.update/platform.xml.tmp (No such file or directory)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
	at org.eclipse.update.internal.configurator.PlatformConfiguration.save(PlatformConfiguration.java:641)
	at org.eclipse.pde.internal.core.UpdateManagerHelper.createPlatformConfiguration(UpdateManagerHelper.java:88)
	at org.eclipse.pde.core.plugin.TargetPlatform.createPlatformConfiguration(TargetPlatform.java:208)
	at org.eclipse.pde.internal.launching.launcher.LaunchConfigurationHelper.createConfigIniFile(LaunchConfigurationHelper.java:192)
	at org.eclipse.pde.launching.EclipseApplicationLaunchConfiguration.getProgramArguments(EclipseApplicationLaunchConfiguration.java:105)
	at org.eclipse.pde.launching.AbstractPDELaunchConfiguration.launch(AbstractPDELaunchConfiguration.java:72)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:942)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1146)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I did notice that successive edits to my RCP launch configuration were being stung by bug 352808.
Comment 4 Curtis Windatt CLA 2011-11-04 15:39:41 EDT
Fixed as part of bug 352808, which will be backported to 3.7.2.

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=3c8b8ad36762f2efc95070079b0421118b542b76

On top of fixing how the config area is saved, I added a safeguard against deleting the home directory.  Before the change, if no config area attribute was found in the config, we could potentially default to "" which can resolve to the home directory.  Now we will default to the same area as we would if the 'use default config area' button was checked.
Comment 5 Curtis Windatt CLA 2011-12-06 17:43:01 EST
We were never able to reproduce the home directory deletion.  Though I am sure we have corrected the incorrect validation (bug 352808), it would be appreciated if the bug reporter (Eric) could verify.