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

Bug 367366

Summary: [prefs] File not deleted when preference node removed
Product: [Eclipse Project] Equinox Reporter: DJ Houghton <dj.houghton>
Component: CompendiumAssignee: equinox.compendium-inbox <equinox.compendium-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: remy.suen
Version: 3.8.0 Juno   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug

Description DJ Houghton CLA 2011-12-21 14:11:56 EST
I'm not sure why this problem hasn't surfaced before. I've been hacking at refactoring the preference code to make it easier for clients to create their own preferences and wrote some new test cases and to my surprise, this one failed.

- get instance scope
- create node /instance/foo
- set a=b key/value pair
- flush /instance/foo
- confirm file is on disk
- remove node /instance/foo
- flush parent

At this point we would expect the file to be removed from disk but it is still there. We don't see this problem in the project preferences because we have change events which react to the deletion and they remove the files from the project using the Workspace APIs. 

In this case we call flush on /instance which iterates over the children and since the child has been removed, it isn't returned in the list and we do nothing.

If we call flush on the node itself, we would get an error because it has been removed.

Seems like we need to keep track of children which have been removed and when flush is called, go through and delete them.
Comment 1 DJ Houghton CLA 2011-12-22 09:31:13 EST
Current behaviour appears to delete the file if all the contents are empty. This is incorrect and we should have an empty file instead because deleting the file will produce incorrect results from the initialization of  parent.childrenNames().
Comment 2 Eclipse Genie CLA 2019-02-05 16:50:17 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Lars Vogel CLA 2019-09-24 13:55:45 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.