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

Bug 345754

Summary: Replace in Files dialog wrecks my files (please believe me, it does)
Product: [Eclipse Project] Platform Reporter: r.berg
Component: SearchAssignee: Platform-Search-Inbox <platform-search-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: critical    
Priority: P3 CC: markus.kell.r, remy.suen
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshots that proof that this is not a user issue
none
Screenshot of our project structure (containing one eclipse-linked-folder) none

Description r.berg CLA 2011-05-13 12:12:31 EDT
Build Identifier: 20110218-0911

Using the replace button in the "search file" dialog (Strg+H) I made a batch-search-and-replace in my project (C++, CDT). 

The search-and-replace damaged my files. Every new search-and-replace I made to fix the last one damaged the files even more. 

Example:
Now My files end up with the line:
 *      Author: Roelof Berg */ #includelude "CMO_OnEventReceiverRegistered.h"

The word "includelude" was some poison from the search-and-replace dialog. I never wrote 'includelude' myself, that did the bug. (RegEx is switched off.)

When I search and replace "includelude" to "include" the following happens:

a) The preview feature shows correctly 'include "CMO_On..."'
b) The editor shows correctly 'include "CMO_On..."'
c) But when I build I see an error. The files have now 'lost' some characters and show: 'includeO_On..."

Every search makes my files worse. The 'includelude' ist just the result of several preceeding replace-bugs. Before I ended up with 'includelude' I had several different replace issues.

Please see the screenshots to be able to believe me that it is a bug. Thank you.

Also attached one of the broken files. A lot of files are broken. Also the part "SEND_EVENT_TO_GUI_PC_FAILEDLED" is the result of a broken batch-rename.


Reproducible: Always

Steps to Reproduce:
1. Open eclipse
2. Use Batch-Rename
3. => Files broken

(I restarted eclipse several times. Allways the same result).

Severity Critical: I lost data. Worst case I lost one day of work when I have to rollback. We unfortunately have to drop eclipse when eclipse tends to damage source-code. (By the way: Our software is safety critical, it is medical software. People can get irreversibly hurt when the search-and-replace dialog introduces a hidden bug.)
Comment 1 r.berg CLA 2011-05-13 12:14:15 EDT
Created attachment 195604 [details]
Screenshots that proof that this is not a user issue
Comment 2 r.berg CLA 2011-05-13 12:43:44 EDT
One thing comes to my mind:

We're using the google-mock C++ mocking framework. In this mocking framework one has to compile the unittests to an application. Therefore we created an eclipse link-folder. He linked the sources of the application-project into the unittest-project.

=> So the sourcefiles are in the workspace twice. One times linked and one times the real file. (And as the screenshots show: I searched in the whole workspace).

... very suspicious :) ...

I bet this is the cause for our data loss.

It is no linux link, on the filesystem the files occur only once. It is an eclipse-linked-folder. When I open the properties dialog of the second folder I see something like "type: linked folder". This is an eclipse feature.

See second attachment.
Comment 3 r.berg CLA 2011-05-13 12:49:46 EDT
Created attachment 195607 [details]
Screenshot of our project structure (containing one eclipse-linked-folder)
Comment 4 r.berg CLA 2011-05-13 13:11:03 EDT
Steps to reproduce (updated);

a) Create two eclipse projects
b) Create one folder in each project and some files within the folders
   Add some file content. E.g. "12 123 1234 12345 123456 1234567 12345678"
c) Add an eclipse-linked-folder. Link this way the folder of the first project into the second project.
d) Perform a batch rename (Strg+H in Eclipse CDT, then switch to Tab "Search Files", press replace). Disable RegEx, search in whole workspace.
e) Perform a rename with strings of different sizes (so not "123" by "abc" - instead something like "123456" by "ab").

=> The text buffers will be processed twice => dara corruption

f) Save, close, open files in another editor: Rename has failed.
Comment 5 Markus Keller CLA 2011-05-13 15:02:38 EDT

*** This bug has been marked as a duplicate of bug 320533 ***