Re: wierd QT warnings and ksycoca errors
Sunil <[email protected]>
| Newsgroups | gmane.comp.kde.devel.cygwin |
|---|---|
| Message-ID | <[email protected]> |
now that's the difference between a rookie getting his feet wet and a vetaran who's seen some real code...thanks ralf. Can I post your email reply to the bug that I have opened? http://bugs.kde.org/show_bug.cgi?id=105387 Thanks, -Sunil --- Ralf Habacker <[email protected]> wrote: > On Tuesday 10 May 2005 03:56, Sunil wrote: > > > There are some places in the kde sources where > > > something like this happens. > > > Usually there is only a file close required. See > the > > > appended patch, which fixes several problems > > > > your patch doesn't fix the problem because the > problem > > with updating ksycoca database is coming from > > database.close() line in kbuildsycoca.cpp : > > > > if (!database.close()) > > { > > fprintf(stderr, "kbuildsycoca: ERROR writing > > database '%s'!\n", > > database.name().local8Bit().data()); > > fprintf(stderr, "kbuildsycoca: Disk > full?\n"); > > #ifdef KBUILDSYCOCA_GUI > > if (!silent) > > KMessageBox::error(0, i18n("Error writing > > database '%1'.\nCheck that the permissions are > correct > > on the directory and the disk is not > > full.\n").arg(path.local8Bit().data()), > > i18n("KBuildSycoca")); > > #endif > > return false; > > } > > > > kdecore/ksavefile.cpp has the following piece of > code > > where close() renames the temporary file to the > > ksycoca in /var/tmp/kdecache-<username>/. This > fails > > because some process has opened that file > READ_ONLY. > > It looks like it is kded daemon as one of > processes > > which has it opened. > And one kdeinit process too > > But I am not sure how to ask these processes to > close this file. > > all access to the ksycoca database is encapsulated > by the class KSycoca, > which contains a signal handler > notifyDatabaseChanged(), wich closes the > database. from kdecore/ksycoca.cpp > > void KSycoca::notifyDatabaseChanged(const > QStringList &changeList) > { > d->changeList = changeList; > //kdDebug(7011) << "got a notifyDatabaseChanged > signal !" << endl; > // kded tells us the database file changed > // Close the database and forget all about what > we knew > // The next call to any public method will > recreate > // everything that's needed. > closeDatabase(); > > // Now notify applications > emit databaseChanged(); > } > > The relating signal is send after updating the > database in > kbuildsycoca:kdemain(): > > if (args->isSet("signal")) > { > // Notify ALL applications that have a ksycoca > object, using a broadcast > QByteArray data; > QDataStream stream(data, IO_WriteOnly); > stream << *g_changeList; > dcopClient->send( "*", "ksycoca", > "notifyDatabaseChanged(QStringList)", > data ); > } > > The problem is that this signal is send to late. A > workaround could be to send > this signal immediatly before the call to > KBuildSycoca::recreate() in > kbuildsycoca:kdemain() > > KBuildSycoca *sycoca= new KBuildSycoca; // > Build data base > if (args->isSet("track")) > > sycoca->setTrackId(QString::fromLocal8Bit(args->getOption("track"))); > >>>>>>>>>>>>>>>>>>>> > if (args->isSet("signal")) > { > // Notify ALL applications that have a ksycoca > object, using a broadcast > QByteArray data; > QDataStream stream(data, IO_WriteOnly); > stream << *g_changeList; > dcopClient->send( "*", "ksycoca", > "notifyDatabaseChanged(QStringList)", > data ); > } > <<<<<<<<<<<<<<<<<<< > if (!sycoca->recreate()) { > > but I don't do if this works in any cases. > > A generic approach is to introduce a new signal for > example > notifyDatabaseUpdatePending or so, which could close > and lock any unwanted > access to the database until the > notifyDatabaseChanged is send. If the > workaround doesn't work we can implemented this. If > you need any assistance, > let me know. > > > > > if (mTempFile.close()) > > { > > if > > > (0==KDE_rename(QFile::encodeName(mTempFile.name()), > > QFile::encodeName(mFileName))) > > return true; // Success! > > mTempFile.setError(errno); > > } > > > > this is where processes open the ksycoca database > in > > kdecore/ksycoca.cpp: > > > > kdDebug(7011) << "Trying to open ksycoca from " > << > > path << endl; > > QFile *database = new QFile(path); > > bool bOpen = database->open( IO_ReadOnly ); > > > > I am not sure how to tackle this. In Unix its so > easy > > to assume that readers won't stop writers from > > writing. Do you think cygwin can demand different > > semantics from kde folks, wherein its the kded > which > > does the update to the database always (currently > eny > > process can call kbuildsycoca to update the > database) > > and everybody, who has the database opened, is > asked > > to close the database before rename() is issued by > > kded? > see above > > Should I file a bug report with kde? > It may be good to ask them what kind of solution > they prefer for this problem > and what they are thinking about the generic > solution. > > > > > 2. I get these in my kde session log all the > time: > > > > > > > > QObject::disconnect: Unexpected null parameter > > > > QObject::connect: Cannot connect > (null)::hide() to > > > > Baghira::DeMaximizer::hide() > > > > > > > > I am not sure if they are errors or warnings. > > > > > > Anyone > > > > > > > any idea? > > > > > > Which application causes this warnings ? It > seems > > > that a qt signal/slot > > > connection couldn't be established. The slot is > > > named in DeMaximizer::hide() > > > in namespace Baghira. > > > > I am not sure which process it is. I just see > these > > repeated very often in the log file. > > try > find <source path> -name '*.cpp' -exec grep -H > "Baghira::DeMaximizer" {} \; > to find the relating code. > > > regards > Ralf > > ? .svn > ? Makefile.out > ? kded.pro > ? kded_rel.pro > ? out.log > ? test/.svn > Index: Makefile.am > =================================================================== > RCS file: /home/kde/kdelibs/kded/Makefile.am,v > retrieving revision 1.31 > diff -u -3 -p -B -r1.31 Makefile.am > --- Makefile.am 26 Oct 2003 23:04:45 -0000 1.31 > +++ Makefile.am 10 May 2005 11:55:46 -0000 > @@ -22,14 +22,14 @@ INCLUDES= -I$(srcdir)/.. > -I$(top_srcdir) > lib_LTLIBRARIES = > kdeinit_LTLIBRARIES = kded.la kbuildsycoca.la > > -kded_la_LDFLAGS = $(all_libraries) -module > -avoid-version > +kded_la_LDFLAGS = $(all_libraries) -module > -avoid-version -static > kded_la_LIBADD = $(LIB_KIO) > kded_la_SOURCES = kded.cpp > kbuildservicetypefactory.cpp \ > kbuildservicefactory.cpp \ > kbuildservicegroupfactory.cpp kdedmodule.cpp > > -kbuildsycoca_la_LDFLAGS = $(all_libraries) -module > -avoid-version > -kbuildsycoca_la_LIBADD = $(LIB_KIO) > +kbuildsycoca_la_LDFLAGS = $(all_libraries) -module > -avoid-version -static > +kbuildsycoca_la_LIBADD = $(LIB_KIO) > kbuildsycoca_la_SOURCES = kbuildsycoca.cpp > kbuildservicetypefactory.cpp \ > kbuildservicefactory.cpp \ > kbuildservicegroupfactory.cpp \ > Index: kbuildsycoca.cpp > =================================================================== > RCS file: /home/kde/kdelibs/kded/kbuildsycoca.cpp,v > retrieving revision 1.111 > diff -u -3 -p -B -r1.111 kbuildsycoca.cpp > --- kbuildsycoca.cpp 18 Feb 2005 18:03:12 -0000 > 1.111 > +++ kbuildsycoca.cpp 10 May 2005 11:55:46 -0000 > @@ -535,6 +535,9 @@ bool KBuildSycoca::recreate() > if (tmp.status() == 0) > { > QString tmpFile = tmp.name(); > +#ifdef __CYGWIN__ > + tmp.close(); > +#endif > tmp.unlink(); > symlink(QFile::encodeName(path), > QFile::encodeName(tmpFile)); > rename(QFile::encodeName(tmpFile), > QFile::encodeName(oldPath)); > @@ -908,6 +911,19 @@ extern "C" KDE_EXPORT int > kdemain(int ar > KBuildSycoca *sycoca= new KBuildSycoca; // > Build data base > if (args->isSet("track")) > > sycoca->setTrackId(QString::fromLocal8Bit(args->getOption("track"))); > + > +#ifdef __CYGWIN__ > + // this is required because windows does not > allow renaming an open file > + if (args->isSet("signal")) > + { > + // Notify ALL applications that have a > ksycoca object, using a broadcast > + QByteArray data; > + QDataStream stream(data, IO_WriteOnly); > + stream << *g_changeList; > + dcopClient->send( "*", "ksycoca", > "notifyDatabaseChanged(QStringList)", data ); > + } > +#endif > + > if (!sycoca->recreate()) { > #ifdef KBUILDSYCOCA_GUI > if (!silent || showprogress) > @@ -926,7 +942,7 @@ extern "C" KDE_EXPORT int > kdemain(int ar > > ::rmdir(QFile::encodeName(servicetypesDir)); > } > } > - > +#ifndef __CYGWIN__ > if (args->isSet("signal")) > { > // Notify ALL applications that have a ksycoca > object, using a broadcast > @@ -935,7 +951,7 @@ extern "C" KDE_EXPORT int > kdemain(int ar > stream << *g_changeList; > dcopClient->send( "*", "ksycoca", > "notifyDatabaseChanged(QStringList)", data ); > } > - > +#endif > #ifdef KBUILDSYCOCA_GUI > if (!silent) { > progress.close(); > > _______________________________________________ > kde-cygwin mailing list > [email protected] > https://mail.kde.org/mailman/listinfo/kde-cygwin > __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail