Review Request 124414: Fix kbuildsycoca5 --global
Dāvis Mosāns
davispuh at gmail.com
Wed Jul 22 15:05:15 UTC 2015
> On jūlijs 22, 2015, 11:47 a.m., David Faure wrote:
> > Why not shortcut that "-" hack altogether, and set XDG_DATA_HOME to the second entry in standardLocations(GenericDataLocation)?
> >
> > In any case, I don't think --global leads to something useful, but sure, fix the assert ;)
>
> Dāvis Mosāns wrote:
> This fix doesn't rely on Qt internals so that if something changes on Qt side it will still work.
> But if we'll always replace XDG_DATA_HOME with 2nd entry from GenericDataLocation and then Qt changes ordering it might not work (like XDG_DATA_HOME could be 2nd entry).
>
> Also it's not said that Qt won't change "~/.local/share" to something else so this ? alternative isn't Qt change proof either.
>
> QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
> for (auto it = paths.constBegin(); it != paths.constEnd(); ++it) {
> if (!it->endsWith("/.local/share")) {
> qputenv("XDG_DATA_HOME", it->toLocal8Bit());
> break;
> }
> }
>
> David Faure wrote:
> Well, this fix does rely on XDG_DATA_HOME having any influence at all on what QStandardPaths returns :-)
> (which is why it won't work on e.g. Windows, but that's a separate story)
>
> If someone adds caching into QStandardPaths, for instance, then the qputenv of "-" will have no effect anymore, while my suggestion would still work.
>
> Qt can't "change the ordering", it's XDG-mandated. Even Qt adding a "more local" path would be a big problem, since XDG says we should save into XDG_DATA_HOME, not somewhere else.
>
> And ~/.local/share is also part of the XDG spec (but this suggested endsWith() is fragile, could match unwanted paths).
>
> Overall I stand by what I said previously.
Ok, updated to just set 2nd entry.
- Dāvis
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124414/#review82800
-----------------------------------------------------------
On jūlijs 22, 2015, 6:04 p.m., Dāvis Mosāns wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124414/
> -----------------------------------------------------------
>
> (Updated jūlijs 22, 2015, 6:04 p.m.)
>
>
> Review request for KDE Frameworks.
>
>
> Repository: kservice
>
>
> Description
> -------
>
> Currently "kbuildsycoca5 --global" does crash because Qt uses XDG_DATA_HOME as first choice for GenericDataLocation
> and with "--global" it's set to "-" which is invalid path. kbuildsycoca5 attempts to create "-/kservices5/ksycoca5" which raises ASSERT failure in KConfig.
>
> ASSERT: "QDir::isAbsolutePath(file)" in file /mnt/AUR/kconfig-git/src/kconfig/src/core/kconfigini.cpp, line 597
>
> #5 0x00007f6128c3c528 in raise () from /usr/lib/libc.so.6
> #6 0x00007f6128c3d93a in abort () from /usr/lib/libc.so.6
> #7 0x00007f61293c74a9 in qt_message_fatal (context=..., message=<synthetic pointer>) at global/qlogging.cpp:1578
> #8 QMessageLogger::fatal (this=this at entry=0x7ffc2f4d2250, msg=msg at entry=0x7f61296345f0 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:781
> #9 0x00007f61293c05bc in qt_assert (assertion=assertion at entry=0x7f6129cbfea8 "QDir::isAbsolutePath(file)", file=file at entry=0x7f6129cbfdf0 "/mnt/AUR/kconfig-git/src/kconfig/src/core/kconfigini.cpp", line=line at entry=597) at global/qglobal.cpp:2968
> #10 0x00007f6129ca299f in KConfigIniBackend::setFilePath (this=0x1ecb360, file=...) at /mnt/AUR/kconfig-git/src/kconfig/src/core/kconfigini.cpp:597
> #11 0x00007f6129c8bc5b in KConfigPrivate::changeFileName (this=0x1ed5af0, name=...) at /mnt/AUR/kconfig-git/src/kconfig/src/core/kconfig.cpp:609
> #12 0x00007f6129ca9a2e in KDesktopFile::KDesktopFile (this=0x7ffc2f4d23e0, resourceType=QStandardPaths::GenericDataLocation, fileName=...) at /mnt/AUR/kconfig-git/src/kconfig/src/core/kdesktopfile.cpp:54
> #13 0x00000000004214e1 in KBuildServiceFactory::createEntry (this=<optimized out>, file=...) at /mnt/AUR/kservice-git/src/kbuildsycoca/kbuildservicefactory.cpp:102
> #14 0x0000000000415358 in KBuildSycoca::createEntry (this=this at entry=0x1eb0950, file=..., addToFactory=addToFactory at entry=true) at /mnt/AUR/kservice-git/src/kbuildsycoca/kbuildsycoca.cpp:153
> #15 0x0000000000416d21 in KBuildSycoca::build (this=this at entry=0x1eb0950) at /mnt/AUR/kservice-git/src/kbuildsycoca/kbuildsycoca.cpp:273
> #16 0x000000000041755d in KBuildSycoca::recreate (this=this at entry=0x1eb0950) at /mnt/AUR/kservice-git/src/kbuildsycoca/kbuildsycoca.cpp:419
> #17 0x0000000000411636 in main (argc=3, argv=<optimized out>) at /mnt/AUR/kservice-git/src/kbuildsycoca/kbuildsycoca.cpp:802
>
>
> Diffs
> -----
>
> src/kbuildsycoca/kbuildsycoca.cpp 074a7d830f7d3781960e64c16f721fae9edc26f9
>
> Diff: https://git.reviewboard.kde.org/r/124414/diff/
>
>
> Testing
> -------
>
> Seems to be working, atleast doesn't crash anymore.
>
>
> Thanks,
>
> Dāvis Mosāns
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150722/0b0f0292/attachment.html>
More information about the Kde-frameworks-devel
mailing list