Version: 1.2.1 (using KDE KDE 3.1) Installed from: RedHat RPMs OS: Linux When setting permissions of a kspread file (maybe this applies to other koffice components also) to 600 and saving the file again, the backup file has different permissions (644), thus is world readeable. IMHO, it should have the same permissions as the original.
This applies to all KOffice programs.
I think that the problem is that the backup file is copied instead of being moved. Have a nice day/evening/night!
Subject: koffice/lib/kofficecore CVS commit by faure: Preserve permissions when creating backup file (only for local files currently) CCMAIL: 54459-done@bugs.kde.org M +17 -9 koDocument.cc 1.268 --- koffice/lib/kofficecore/koDocument.cc #1.267:1.268 @@ -53,4 +53,5 @@ #include <qimage.h> #include <kiconloader.h> +#include <kfileitem.h> #include <qdir.h> #include <qfileinfo.h> @@ -298,14 +299,21 @@ bool KoDocument::saveFile() QApplication::setOverrideCursor( waitCursor ); - if ( KIO::NetAccess::exists( url() ) ) { // this file exists => backup + if ( backupFile() ) { + KIO::UDSEntry entry; + if ( KIO::NetAccess::stat( url(), entry ) ) { // this file exists => backup + KFileItem item( entry, url() ); + Q_ASSERT( item.name() == url().fileName() ); KURL backup; if ( d->m_backupPath.isEmpty()) - backup= url(); + backup = url(); else backup = d->m_backupPath +"/"+url().fileName(); backup.setPath( backup.path() + QString::fromLatin1("~") ); - if ( backupFile() ) { KIO::NetAccess::del( backup ); // Copy does not remove existing destination file KIO::NetAccess::copy( url(), backup ); + // Not network transparent. TODO: use NetAccess::file_copy once KDE-3.2 is required, + // or implement KIO::NetAccess::chmod (or fire an async ChmodJob?). + if ( backup.isLocalFile() ) + ::chmod( QFile::encodeName( backup.path() ), item.permissions() ); } }
Please reopen. I found the same behaviour again in Koffice 1.3_rc1 (used with KDE 3.2.0 Beta2).
As per comment 4.
Still valid for 1.3.1.
Which KDE version?
I'm on 3.2.2 now.
CVS commit by faure: Oh well, I suck. Now this should fix 54459 again. I'll backport. CCMAIL: 54459-done@bugs.kde.org M +4 -4 koDocument.cc 1.308 --- koffice/lib/kofficecore/koDocument.cc #1.307:1.308 @@ -48,7 +48,7 @@ #include <kmessagebox.h> #include <kdeversion.h> +#include <kfileitem.h> #if ! KDE_IS_VERSION(3,1,90) #include <kdebugclasses.h> -#include <kfileitem.h> #endif @@ -383,9 +383,9 @@ bool KoDocument::saveFile() backup = d->m_backupPath +"/"+url().fileName(); backup.setPath( backup.path() + QString::fromLatin1("~") ); -#if KDE_IS_VERSION(3,1,90) - KIO::NetAccess::file_copy( url(), backup, -1, true /*overwrite*/, false /*resume*/, shells().current() ); -#else KFileItem item( entry, url() ); Q_ASSERT( item.name() == url().fileName() ); +#if KDE_IS_VERSION(3,1,90) + KIO::NetAccess::file_copy( url(), backup, item.permissions(), true /*overwrite*/, false /*resume*/, shells().current() ); +#else KIO::NetAccess::del( backup ); // Copy does not remove existing destination file KIO::NetAccess::copy( url(), backup );