Bug 453455 - KBibTeX 0.9.90 won't start after I updated to Ubuntu 22.04
Summary: KBibTeX 0.9.90 won't start after I updated to Ubuntu 22.04
Status: RESOLVED FIXED
Alias: None
Product: KBibTeX
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-06 07:45 UTC by hakonanes
Modified: 2023-03-03 20:12 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Reversing order of two instructions (578 bytes, patch)
2022-12-30 11:32 UTC, Thomas Fischer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hakonanes 2022-05-06 07:45:57 UTC
SUMMARY
KBibTeX 0.9.90 won't start after I updated to Ubuntu 22.04. Other KDE software like Okular starts as normal.

STEPS TO REPRODUCE
1. Install KBibTex 0.9.90 on Ubuntu 22.04
2. Run "kbibtex" in terminal

OBSERVED RESULT
Output when running the software in the terminal ("Minnesegmentsfeil (kjerne lagret i fil)" is Norwegian for "Segmentation fault (core dumped)")

$ kbibtex
kbibtex.program: Starting KBibTeX version "0.9.90"
QCommandLineParser: option not defined: "author"
QCommandLineParser: option not defined: "license"
QCommandLineParser: option not defined: "desktopfile"
Icon theme "breeze" not found.
kf.config.core: "KConfigIni: In file /usr/share/kservices5/searchproviders/google_advanced.desktop, line 132: " "Invalid escape sequence \"\\{\"."
kf.service.services: The desktop entry file "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop"
kf.i18n: Trying to convert empty KLocalizedString to QString.
Hspell: can't open /usr/share/hspell/hebrew.wgz.sizes.
kf.sonnet.clients.hspell: HSpellDict::HSpellDict: Init failed
kbibtex.program: Located KPart service: "kbibtexpart" with description "KParts component to view and edit bibliographic files" from library "kbibtexpart"
kbibtex.part: Creating KBibTeX Part of version "0.9.90"
kbibtex.io: Using ICU in Encoder class
kbibtex.io: Using ICU in Encoder class
Minnesegmentsfeil (kjerne lagret i fil)

EXPECTED RESULT
The software opening normally as was the case on Ubuntu 21.10.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 22.04 LTS
KDE Plasma Version: N/A
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Comment 1 Raymond Wan 2022-05-09 14:03:13 UTC
I can confirm that this happens on Ubuntu 22.04 .  What I also found out is kbibtex will start if I erase these files:

    rm -f -r .local/share/kbibtex .cache/kbibtex/ .config/kbibtexrc

But if I start a new BibTeX file and put a single entry like this:

    @article{New1,
    	author = {a and b},
	journal = {def},
	title = {{abc}},
	year = {2010}
     }

it will save fine.  If I exit and try to load this file with a single entry back in, then it crashes again with "segmentation fault".  So, I don't think it is a problem of my input .bib files or any of the configuration files (unless there is still another one which I haven't yet deleted).
Comment 2 hakonanes 2022-05-10 07:43:20 UTC
Thank you for the additional information, Raymond. I experience the same behaviour as you do: after deleting the cache files you mention, KBibTeX opens without issue, but when opening the .bib file I've always used, the software crashes.
Comment 3 Raymond Wan 2022-05-13 17:37:25 UTC
Thank you for reporting the original problem, hakonanes!

Out of desperation (as I need to use it), I even tried kbibtex for Ubuntu 21.10 (version 0.9.90-1) and Ubuntu 20.04 (0.8.1-1ubuntu5).  I needed to install kbibtex, kbibtex-data, and icu.  As kbibtex has other dependencies, I didn't think this could work.  But I wasn't asked for other dependencies.

However, it crashed in exactly the same way (i.e., segmentation fault), even though I have used kbibtex on Ubuntu 21.10 and Ubuntu 20.04 before.  This was surprising and, unfortunately, I don't know what this means...  Just thought I'd mention this so that you won't waste time trying this.
Comment 4 Antoine D. 2022-06-03 22:14:35 UTC
Since your problem is now a crashing issue, I invite you to have a look to bug 433084. You might find my experience interesting (even though it solves nothing).
Comment 5 Raymond Wan 2022-06-03 22:45:42 UTC
(In reply to Antoine D. from comment #4)
> Since your problem is now a crashing issue, I invite you to have a look to
> bug 433084. You might find my experience interesting (even though it solves
> nothing).

Thank you for the pointer!  But I think it would be more appropriate for your comment to be attached to this bug rather than that one.  After all, it looks like all of us are experiencing this bug with Ubuntu 22.04 .  Whereas that original bug was first file in February 2021.  That one was also pulled from the Git repository, whereas this one is the version that was released with this Ubuntu version.

Of course, it's entirely possible that the cause of the two bugs is the same...
Comment 6 Antoine D. 2022-06-04 03:15:01 UTC
(In reply to Raymond Wan from comment #5)
When I wanted to report my bug in May 20, I searched for a crashing KBibTeX and I found bug 433084 "KBibTeX crashes when opening .bib file" which was exactly my problem. I never had a starting issue (I usually start my apps with the launcher). And I guess 847240@gmail.com was in the same situation as me, as he or she chose to report the problem there in May 17.
It's surely a good idea to put hakonanes' comment, 847240@gmail.com's one, yours and mine in the same place but I don't think I can do that on my own.
Comment 7 Antoine D. 2022-06-07 04:07:07 UTC
I have partly solved my problem: I use the Flatpak version of KBibTeX. There's no crash anymore, but the "Open a file" button in KBibTeX doesn't work. To open a file, you have to use your file manager, select your file and click "Open with KBibTeX". It is not perfect but at least I can open a file and do something in KBibTeX.
If you want to know how I got to this solution, see https://bugs.kde.org/show_bug.cgi?id=433084#c15 and then https://www.kubuntuforums.net/forum/newbie-support/help-the-new-guy/663425-how-can-i-get-the-qt5-patch-collection-to-solve-my-crashing-kbibtex-problem
Comment 8 hakonanes 2022-06-07 08:30:25 UTC
(In reply to Antoine D. from comment #7)
> I have partly solved my problem: I use the Flatpak version of KBibTeX.

Thank you all for your efforts troubleshooting this issue. KBibTeX from Flatpak works mostly as expected.

In addition to the problem you mention Antoine, I cannot open PDFs of entries via "Open Document", even though their "localfile" field has a valid file location. I didn't have this problem before. I hope to switch back to the KBibTeX version from apt once a new Qt version > 5.15.3 is available with the patch you mentioned.
Comment 9 Thomas Fischer 2022-12-30 11:32:52 UTC
Created attachment 154903 [details]
Reversing order of two instructions

I think I have found the solution for this problem. Please apply this patch to see if it solves your problem.
Comment 10 Thomas Fischer 2023-01-03 22:07:04 UTC
Git commit 4aea6ed35b1629b3dba65a441db7567eece5eab0 by Thomas Fischer.
Committed on 01/01/2023 at 22:04.
Pushed by thomasfischer into branch 'kbibtex/0.10'.

Fixing crash when opening .bib file

In certain situations, also depending on Linux distributions (varying Qt
and KDE Frameworks versions), opening a bibliography file can cause
crashes (segmentation faults) due to an invalid model or its underlying
data.

This commit changes the order of two instructions. Now first an internal
variable is properly set. Only then an update on the model is applied.

The largest part of this commit is a new test that reproducibly crashes
without the changed order of two instructions, but passes after the fix
has been applied.
Related: bug 433084

M  +1    -1    src/gui/file/sortfilterfilemodel.cpp
M  +36   -0    src/test/CMakeLists.txt
A  +66   -0    src/test/kbibtexguitest.cpp     [License: GPL (v2+)]

https://invent.kde.org/office/kbibtex/commit/4aea6ed35b1629b3dba65a441db7567eece5eab0
Comment 11 Thomas Fischer 2023-01-03 22:09:36 UTC
As you can see in the previous comment, a commit was made to apply the patch I published earlier.

There is a helper script that allows you to test this code with little hassle. Please proceed as follows:

0. Uninstall the distribution-provided KBibTeX installation
1. Get this script:  https://invent.kde.org/thomasfischer/kbibtex-related/-/raw/master/run/run-kbibtex.sh?inline=false
2. Run as normal user:   bash run-kbibtex.sh https://invent.kde.org/office/kbibtex.git kbibtex/0.10

None of the steps above requires root/sudo/su as everything happens in /tmp. If cmake complains about missing development libraries, simply install those via your Linux distribution's package manager and restart the script. Later, you can remove those packages if you see no further need.
Comment 12 Thomas Fischer 2023-01-04 22:01:55 UTC
Git commit ee125af91d7d4e8dfc8927cad85694b55de27a84 by Thomas Fischer.
Committed on 04/01/2023 at 22:00.
Pushed by thomasfischer into branch 'master'.

Fixing crash when opening .bib file

In certain situations, also depending on Linux distributions (varying Qt
and KDE Frameworks versions), opening a bibliography file can cause
crashes (segmentation faults) due to an invalid model or its underlying
data.

This commit changes the order of two instructions. Now first an internal
variable is properly set. Only then an update on the model is applied.

The largest part of this commit is a new test that reproducibly crashes
without the changed order of two instructions, but passes after the fix
has been applied.

This commit is a forward-port of commit 4aea6ed35b1629b3dba65a44 from
branch 'kbibtex/0.10'.
Related: bug 433084

M  +36   -0    src/test/CMakeLists.txt
A  +66   -0    src/test/kbibtexguitest.cpp     [License: GPL (v2+)]

https://invent.kde.org/office/kbibtex/commit/ee125af91d7d4e8dfc8927cad85694b55de27a84
Comment 13 Serguei Miridonov 2023-01-29 14:04:29 UTC
(In reply to Thomas Fischer from comment #11)
> As you can see in the previous comment, a commit was made to apply the patch
> I published earlier.
> 
> There is a helper script that allows you to test this code with little
> hassle. Please proceed as follows:
> 
> 0. Uninstall the distribution-provided KBibTeX installation
> 1. Get this script: 
> https://invent.kde.org/thomasfischer/kbibtex-related/-/raw/master/run/run-
> kbibtex.sh?inline=false
> 2. Run as normal user:   bash run-kbibtex.sh
> https://invent.kde.org/office/kbibtex.git kbibtex/0.10
> 
> None of the steps above requires root/sudo/su as everything happens in /tmp.
> If cmake complains about missing development libraries, simply install those
> via your Linux distribution's package manager and restart the script. Later,
> you can remove those packages if you see no further need.

I have just tried this and got:

Application:                  kbibtex
Expected application binary:  /tmp/mirsev-kbibtex-usr/bin/kbibtex
Git URL:                      https://invent.kde.org/office/kbibtex.git
Git branch or tag:            kbibtex/0.10
Installation prefix:          /tmp/mirsev-kbibtex-usr
Build directory:              /tmp/mirsev-kbibtex-build-c22204ca6e7d88358dd057ebfba85315
Configuration directory:      /tmp/mirsev-kbibtex-xdg-c22204ca6e7d88358dd057ebfba85315
Already on 'kbibtex/0.10'
Your branch is up to date with 'origin/kbibtex/0.10'.
Already up to date.
CMake Error at CMakeLists.txt:17 (find_package):
  Could not find a package configuration file provided by "ECM" (requested
  version 5.51) with any of the following names:

    ECMConfig.cmake
    ecm-config.cmake

  Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
  to a directory containing one of the above files.  If "ECM" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/tmp/mirsev-kbibtex-build-c22204ca6e7d88358dd057ebfba85315/CMakeFiles/CMakeOutput.log".
Comment 14 Serguei Miridonov 2023-01-29 16:04:29 UTC
After installing in Ubuntu 22.04.1

libecm-dev extra-cmake-modules kdevelop libkf5xmlgui-dev qtcreator qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5charts5-dev libqt5datavisualization5-dev libqt5gamepad5-dev libqt5gstreamer-dev libqt5networkauth5-dev libqt5opengl5-dev libqt5remoteobjects5-dev libqt5scxml5-dev libqt5sensors5-dev libqt5serialbus5-dev libqt5serialport5-dev libqt5svg5-dev libqt5texttospeech5-dev libqt5virtualkeyboard5-dev libqt5waylandclient5-dev libqt5waylandcompositor5-dev libqt5webkit5-dev libqt5webchannel5-dev libqt5websockets5-dev libqt5webview5-dev libqt5x11extras5-dev libqt5xmlpatterns5-dev libkf5kio-dev libkf5parts-dev libkf5wallet-dev libkf5crash-dev libkf5texteditor-dev libkf5doctools-dev libpoppler-qt5-dev

the script ran and compiled the program but then I've got

 ...
-- Installing: /tmp/mirsev-kbibtex-usr/share/doc/HTML/en/kbibtex/zotero.png
-- Installing: /tmp/mirsev-kbibtex-usr/share/man/man1/kbibtex.1
dirname: missing operand
Try 'dirname --help' for more information.
kbuildsycoca5 running...
/tmp/mirsev-kbibtex-usr/bin/kbibtex: error while loading shared libraries: libkbibtexgui.so.0: cannot open shared object file: No such file or directory

So, I've set manually

LD_LIBRARY_PATH=/tmp/mirsev-kbibtex-usr/lib/x86_64-linux-gnu

and kbibtex runs but error appears with a message:

KBibTeX seems to be not installed completely. KBibTeX could not locate its own KPart.
Only limited functionality will be available

and I only could see plain text of my BIB file, not the table as was before.

So, I then cloned the repository from https://invent.kde.org/office/kbibtex.git and checked out 0.10 version. After commands

cmake .
make
sudo make install

it seems to work as expected.
Comment 15 Thomas Fischer 2023-03-03 20:12:25 UTC
> KBibTeX seems to be not installed completely. KBibTeX could not locate its
> own KPart.
> Only limited functionality will be available

The easiest way for you to test KBibTeX without needing to run "sudo make install" would have been the script I have prepared for such occassions:
https://userbase.kde.org/KBibTeX/Development#Quick_Start_to_Run_KBibTeX_from_Git

Otherwise, I interpret your answer that the bug has been fixed and this report can be closed.
Thank you for your feedback!