Bug 178640

Summary: KSaveFile::simpleBackupFile should overwrite old backups
Product: [Frameworks and Libraries] kdelibs Reporter: Robby Stephenson <robby>
Component: kdecoreAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch to remove backup file before attempting to copy to it

Description Robby Stephenson 2008-12-24 08:20:58 UTC
Version:            (using KDE 4.1.3)
OS:                Linux
Installed from:    SuSE RPMs

KSaveFile::simpleBackupFile eventually calls QFile::copy with the backup file name. However, if the file exists, QFile::copy just fails.

I would expect the behavior to be such that existing backup files would be overwritten by repeated calls to simpleBackupFile(), in which case, old backups should be removed before calling QFile::copy(). The numberedBackupFile() function does this.

Original email at 
http://lists.kde.org/?l=kde-devel&m=123007467204148&w=2

I'll attach a simple patch.
Comment 1 Robby Stephenson 2008-12-24 08:21:41 UTC
Created attachment 29599 [details]
Patch to remove backup file before attempting to copy to it
Comment 2 Allen Winter 2008-12-24 15:11:03 UTC
SVN commit 901154 by winterz:

In simpleBackupFile(), remove the backup file before copying the source file.
This makes the copy work, just in case a backup file already exists.

The remove will fail if a backup file doesn't exist (on the first call),
but that's ok.

Patch from Robby Stephenson.
BUG: 178640


 M  +1 -0      ksavefile.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=901154