Bug 178640 - KSaveFile::simpleBackupFile should overwrite old backups
Summary: KSaveFile::simpleBackupFile should overwrite old backups
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdecore (show other bugs)
Version: 4.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-24 08:20 UTC by Robby Stephenson
Modified: 2008-12-24 15:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to remove backup file before attempting to copy to it (398 bytes, patch)
2008-12-24 08:21 UTC, Robby Stephenson
Details

Note You need to log in before you can comment on or make changes to this bug.
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