Review Request 124414: Fix kbuildsycoca5 --global

Dāvis Mosāns davispuh at gmail.com
Wed Jul 22 14:35: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 ;)

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;
          }
      }


- Dāvis


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124414/#review82800
-----------------------------------------------------------


On jūlijs 21, 2015, 11:51 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 21, 2015, 11:51 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/3cf1248e/attachment.html>


More information about the Kde-frameworks-devel mailing list