Bug 20532 - Undoing a copy operation might delete a modified file causing loss of data.
Summary: Undoing a copy operation might delete a modified file causing loss of data.
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: RedHat RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 140218 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-02-16 00:48 UTC by tommasopaba
Modified: 2007-01-30 08:39 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tommasopaba 2001-02-16 00:35:15 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           konqueror
Version:           KDE 2.0.1 \6
Severity:          normal
Installed from:    RedHat RPMs
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

Conqueror allows you to undo a copy operation even if the file has been modified.
When you do it the modified file is deleted and changes are lost forever.
A similar problem occurs when cutting: if you cut and paste a file and modify it and then you undo the paste operation the *modified* file is copied back into the original position! 
Imho it should not be possible to undo a cut/copy/paste operation on a file if the file has been modified afterwards. It leads to incongrous and potentially dangerous behaviour so the corresponding menu item should be disabled.
Anyway congratulations for your wonderful work!

(Submitted via bugs.kde.org)
Comment 1 Steven Homolya 2002-12-07 06:06:10 UTC
I can confirm this bug for konqueror 2.2.1 (RH 7.2)

Having a modified file copied to a different location does not result in loss 
of data. However the following does:

* drag-and-drop copy a file to a new location (or the same location with a new 
name)
* modify the copied file in an external editor
* ctrl-z (Undo) in konqueror

--> modified file go bye-bye!
Comment 2 Simon Hausmann 2002-12-07 11:29:16 UTC
ACK. It's hard (if not impossible) to fix for cut though. 
Comment 3 Olaf Jan Schmidt 2002-12-07 13:42:41 UTC
The only way I see to fix this for cut is to save a hash of the file. 
Comment 4 Simon Hausmann 2002-12-07 13:45:03 UTC
and the fire up a messagebox then in case there is a mismatch when pasting you mean? 
Comment 5 Icekiss 2003-11-15 14:18:02 UTC
Confirmed for copy/undo in CVS HEAD from 5.11.03
Comment 6 Matt 2005-01-18 07:56:47 UTC
Confirmed for KDE 3.3.0, Konqueror 3.3.
Wiped out 2 days worth of work! =)

Thanks for all the hard work!
2 days is a small price to pay for progress! =)
Comment 7 Rainer Endres 2005-01-27 22:01:13 UTC
i can still verify this bug in current CVS HEAD (pre-3.4beta2)

Since this bug can cause data loss, doesn't it deserve a higher severity? 

Comment 8 Matthias Ansorg 2005-03-25 11:57:39 UTC
Related problem: Undoing a "create new -> file -> text file" (or similar) operation will delete the file even if modified with an external editor in between. Results in loss of data.

Proposal: you could provide redo functionality or throw the file in the trash instead of deleting it.

konqueror is high quality software anyway :)
Comment 9 David Faure 2007-01-19 23:16:07 UTC
*** Bug 140218 has been marked as a duplicate of this bug. ***
Comment 10 David Faure 2007-01-24 19:04:16 UTC
SVN commit 626835 by dfaure:

Fixed 6-years old bug 20532: Undoing a copy operation might delete a modified file causing loss of data.
A confirmation message box is shown when undoing a copy after modifying the file [this relies on copy preserving the mtime though, which might not be true for all protocols but we'll have to fix that].

The less severe case of move, modify, undo (no data loss, but the modified file is moved back) can't be fixed in all cases, since moving a whole directory can be done by a simple rename() call, so we have no information on all the files inside the directory. For single files it could be done though, but that's not implemented by this.

BUG: 20532


 M  +2 -2      kdebase/libkonq/konq_operations.cc  
 M  +275 -212  kdebase/libkonq/konq_undo.cc  
 M  +28 -5     kdebase/libkonq/konq_undo.h  
 M  +30 -23    kdebase/libkonq/konq_undo_p.h  
 M  +64 -17    kdebase/libkonq/tests/konqundomanagertest.cpp  
 M  +6 -2      kdebase/libkonq/tests/konqundomanagertest.h  
 M  +3 -5      kdebase/workspace/kcontrol/kfontinst/kcmfontinst/KCmFontInst.cpp  
 M  +1 -1      kdebase/workspace/kcontrol/kfontinst/kcmfontinst/KCmFontInst.h  
 M  +7 -6      kdelibs/kio/kio/copyjob.cpp  
 M  +3 -1      kdelibs/kio/kio/copyjob.h