Bug 4938 - Deleting Project with Read-only files will cause non-readonly files to be erased if user said to NOT erase them (1GLG2WT)
Summary: Deleting Project with Read-only files will cause non-readonly files to be era...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: Other Windows All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Randy Giffen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 5259 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-12 13:08 EDT by DJ Houghton CLA
Modified: 2002-02-01 12:35 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2001-10-12 13:08:05 EDT
PRODUCT VERSION:
Test on 135 and 137 on Windows.

DESCRIPTION:
This one is high priority, since the customer's data is destroyed.   Here are 
the steps to reproduce it: 

1) In the file system, create a folder c:\temp\test
2) Put 2 files in that folder, and make one of them read-only.     I created 
rw.txt, and ro.txt and I made ro.txt file read-only. 
3) In Eclipse, create a Simple Project  called SimpleProject.  When you create 
it, don't use the default location,  but
instead point it to c:\temp\test
4) You see both files in the Workbench
5) Delete the SimpleProject.  When asked, "Delete all its contents under 
c:\temp\test as well?"  say No.
6) Then you see a message "ro.txt is read only.  Do you wish to delete it?"  ---
 you think, this is strange since I just 
said I don't want any file to be deleted, but you play along and you answer No. 
7) If you look in the file system you will see that c:\temp\test\rw.txt is 
GONE  -- even though the use said NOT to 
delete any files. 



NOTES:
Comment 1 Randy Giffen CLA 2001-10-22 15:58:37 EDT
PAULACOX - 10/12/2001: FYI...We are able to recreate the problem when using the 
default directory too. 
Comment 2 DJ Houghton CLA 2001-10-22 17:25:27 EDT
I found the same behaviour on 0.202a. All comments below are based on this 
build. Please inform if behaviour in UI in this situation has significantly 
changed between 0.137 and 0.202a.

I traced the code in org.eclipse.ui.actions.DeleteResourceAction.

When you have a project which contains no read-only files, then the 
ReadOnlyStatChecker returns the project itself as the "resource to delete", and 
then the IProject API is called, the project is deleted, and the contents are 
left on disk as requested by the user.

If your project contains a read-only file, then the ReadOnlyStateChecker 
returns all non-r/o resources within that project as the list of "resources to 
delete". Then the IResource#delete API is called and each resource is deleted, 
even though you said don't delete the project contents.

Moving bug to Platform/UI for investigation/comment.

Comment 3 Randy Giffen CLA 2001-10-23 09:35:24 EDT
Fixed DeleteResourceAction to not check for R/O files if it is not going to 
delete project contents.Released in 2.0 stream
Will need to create a 1.0 build submission with this fix.
Comment 4 Randy Giffen CLA 2001-10-23 16:14:10 EDT
Bug 4938  Deleting Project with Read-only files will cause non-readonly files 
to be erased if user said to NOT erase them (1GLG2WT)  Testing this fix I 
discovered another problem case
1) Create a project with one folder and one file.
2) Now create a file in the folder and makeit read only
3) Delete the project, say yes to delete content
4) When asked to delete the RO file pick cancel
5) The other file is deleted (even though you chose cancel)

Fixed in DeleteResourceAction and ReadOnlyStateChecker in 2.0 stream
Comment 5 Randy Giffen CLA 2001-10-23 16:16:28 EDT
Nick and I created a version v138 of our org.eclipse.ui project
(based on v137a) with the above fixes and changed the plugin version number in 
the plugin.xml file to 1.0.1
Comment 6 DJ Houghton CLA 2001-10-24 06:45:48 EDT
PRODUCT VERSION:
Test on 135 and 137 on Windows.

Comment 7 John Arthorne CLA 2001-10-25 14:03:35 EDT
*** Bug 5259 has been marked as a duplicate of this bug. ***
Comment 8 Kevin Haaland CLA 2002-02-01 11:44:32 EST
Randy, please verify in the latest 2.0 builds. 
Comment 9 Randy Giffen CLA 2002-02-01 12:35:43 EST
Verified