Problem with ksycoca on windows

Jaroslaw Staniek js at iidea.pl
Fri Feb 8 12:14:00 GMT 2008


Christian Ehrlicher said the following, On 2008-02-08 07:11:

> I've a problem on windows - when ksycoca is running / the db is open, I
> can't execute kbuildsycoca to update the db. The problem is that
> kbuildsycoca can't overwrite an open file on windows.

Interesting that I've even complained on this during the kdepim meeting :)

Look at src/corelib/io/qfsfileengine_win.cpp:
bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
{
/...
     // All files are opened in share mode (both read and write).
     DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;


So... we perhaps lack FILE_SHARE_DELETE flag here...

If we need that, we could patch Qt (and request accepting the patch by TT) to 
add support for FILE_SHARE_DELETE semantics.

See also: [1] http://mg.to/2004/09/30/file_share_delete-in-shell-extension


> There're two solutions
> - let kbuildsycoca create ksyscoca.new and rename the file when db is closed

Good idea; Unless I have oversimplified that, as mentioned in [1], with 
FILE_SHARE_DELETE flag the processes will still use the old file though unless 
they release handles.

> - open the file in a special mode so I can delete it also someone has an
> open file handle on it. 

 > But for this I can't use QFile

Why? because we cannot set sharing flags FILE_SHARE_WRITE | FILE_SHARE_READ | 
FILE_SHARE_DELETE as in CreateFile()?
If we cannot alter the sharing for handle returned by QFile::handle(), we 
could develop a wrapper... but hope the changes in Qt will make it unnecessary.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)




More information about the kde-core-devel mailing list