Bug 457662

Summary: ghostscript --with-tesseract crashes digiKam on startup
Product: [Applications] digikam Reporter: antikapitalista
Component: Plugin-DImg-MagickAssignee: Digikam Developers <digikam-bugs-null>
Status: REOPENED ---    
Severity: crash CC: caulier.gilles, metzpinguin
Priority: NOR Keywords: drkonqi
Version: 7.7.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description antikapitalista 2022-08-09 10:00:15 UTC
Application: digikam (7.7.0)
 (Compiled from sources)
Qt Version: 5.15.5
Frameworks Version: 5.96.0
Operating System: Linux 5.13.12-x86_64 x86_64
Windowing System: Wayland
Distribution: "Gentoo Linux"
DrKonqi: 5.25.4 [KCrashBackend]

-- Information about the crash:
While starting digiKam.

The crash can be reproduced every time.

-- Backtrace:
Application: digiKam (digikam), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f2b6031bfaa in  () at /usr/lib64/libgs.so.9
#5  0x00007f31bbe08ede in  () at /lib64/ld-linux-x86-64.so.2
#6  0x00007f31bbe08fc4 in  () at /lib64/ld-linux-x86-64.so.2
#7  0x00007f31b90dd454 in _dl_catch_exception () at /lib64/libc.so.6
#8  0x00007f31bbe1009e in  () at /lib64/ld-linux-x86-64.so.2
#9  0x00007f31b90dd3fa in _dl_catch_exception () at /lib64/libc.so.6
#10 0x00007f31bbe10438 in  () at /lib64/ld-linux-x86-64.so.2
#11 0x00007f31b900ead8 in  () at /lib64/libc.so.6
#12 0x00007f31b90dd3fa in _dl_catch_exception () at /lib64/libc.so.6
#13 0x00007f31b90dd4af in _dl_catch_error () at /lib64/libc.so.6
#14 0x00007f31b900e5c7 in  () at /lib64/libc.so.6
#15 0x00007f31b900eb89 in dlopen () at /lib64/libc.so.6
#16 0x00007f31aaa0ad17 in  () at /usr/lib64/libltdl.so.7
#17 0x00007f31aaa060c0 in  () at /usr/lib64/libltdl.so.7
#18 0x00007f31aaa0635a in  () at /usr/lib64/libltdl.so.7
#19 0x00007f31aaa0894c in  () at /usr/lib64/libltdl.so.7
#20 0x00007f31aaa09a53 in lt_dlopenadvise () at /usr/lib64/libltdl.so.7
#21 0x00007f31b77e06e9 in  () at /usr/lib64/libMagickCore-7.Q32HDRI.so.10
#22 0x00007f31b77e0031 in  () at /usr/lib64/libMagickCore-7.Q32HDRI.so.10
#23 0x00007f31b77d96e8 in GetMagickInfo () at /usr/lib64/libMagickCore-7.Q32HDRI.so.10
#24 0x00007f31b77d9af7 in GetMagickInfoList () at /usr/lib64/libMagickCore-7.Q32HDRI.so.10
#25 0x00007f2b6250dad9 in DigikamImageMagickDImgPlugin::DImgImageMagickPlugin::decoderFormats() const (this=this@entry=0x558c721a0f50) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.cpp:267
#26 0x00007f2b6250dee7 in DigikamImageMagickDImgPlugin::DImgImageMagickPlugin::DImgImageMagickPlugin(QObject*) (this=this@entry=0x558c721a0f50, parent=parent@entry=0x0) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/dplugins/dimg/imagemagick/dimgimagemagickplugin.cpp:67
#27 0x00007f2b6250c97e in qt_plugin_instance() () at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0_build/core/dplugins/dimg/imagemagick/DImg_ImageMagick_Plugin_autogen/EWIEGA46WW/moc_dimgimagemagickplugin.cpp:118
#28 0x00007f31b9707a77 in  () at /usr/lib64/libQt5Core.so.5
#29 0x00007f31baef995c in Digikam::DPluginLoader::Private::loadPlugins() (this=0x558c72167f70) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/libs/dplugins/setup/dpluginloader_p.cpp:210
#30 0x00007f31baef6f67 in Digikam::DPluginLoader::init() (this=<optimized out>) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/libs/dplugins/setup/dpluginloader.cpp:70
#31 0x00007f31bb8aeb80 in Digikam::DigikamApp::DigikamApp() (this=this@entry=0x558c725ce330, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/app/main/digikamapp.cpp:142
#32 0x0000558c70123025 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/media-gfx/digikam-7.7.0/work/digikam-7.7.0/core/app/main/main.cpp:364
[Inferior 1 (process 787573) detached]

Reported using DrKonqi
Comment 1 Maik Qualmann 2022-08-09 10:35:31 UTC
The bug title indicates that you didn't install GDB in 64 bit. Can you have a similar problem with ImageMagick? The crash occurs in ImageMagick and is also unknown until now.

Maik
Comment 2 caulier.gilles 2022-08-09 11:20:34 UTC
Perhaps a mixing 32 and 64 bits binaries ?

Gilles
Comment 3 antikapitalista 2022-08-09 12:34:29 UTC
Well, I put this here as a sort of placeholder, because it looks really weird.
An even weirder thing is that this was a native build in a pure amd64 system, no multilib. I am going to rebuild binutils, binutils-libs and gdb with the multitarget USE flag disabled, as it is not needed anyway.
Comment 4 antikapitalista 2022-08-09 18:24:30 UTC
QTWEBENGINE_DISABLE_SANDBOX=1 fixed it for me.

Alright, you can close it.

At first, I was perplexed because it was crashing all the time but often at different places. So i rebuilt digiKam with almost everything turned off, then it began crashing rather consistently at the same place.
And then I noticed the message that it did not like running as UID=0 (root) without --no-sandbox.

Thus, QtWebEngine was exiting and letting the rest of digiKam implode. At first it was crashing at seemingly random places; digKam being multithreaded, the first victim was essentially a random thread that wanted to have something to do with QtWebEngine, which had crapped out. It is broken by design and digiKam is its innocent victim.

I am awfully sorry to have wasted your time. It has been my fault all along.
Comment 5 antikapitalista 2022-08-09 20:21:55 UTC
Perhaps I spake too early...

ImageMagick was still crashing it; more specifically: ImageMagick configured --with-gslib and linked to ghostscript-gpl-9.55.
Comment 6 antikapitalista 2022-08-09 21:19:22 UTC
(In reply to antikapitalista from comment #5)
> Perhaps I spake too early...
> 
> ImageMagick was still crashing it; more specifically: ImageMagick configured
> --with-gslib and linked to ghostscript-gpl-9.55...

... and still more specifically, digiKam crashes with versions of >=ghostscript-gpl-9.54 ; versions of <=ghostscript-9.53.3 work as expected.
Comment 7 caulier.gilles 2022-08-10 05:17:24 UTC
It crash in 32 bits HDRI version of imagemagick.

For the digiKam bundle we disable HDRI support in IM : 

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/3rdparty/ext_imagemagick/CMakeLists.txt#L26

It's probably a UPSTREAM bug in IM code.

Gilles Caulier
Comment 8 antikapitalista 2022-08-10 12:29:42 UTC
The culprit is Ghostscript configured --with-tesseract, while ImageMagick is configured with --with-gslib.

That is why the conflict appears only in release packages of Ghostscript, which additionally bundle Tesseract (and Leptonica).

For ImageMagick configured --with-gslib, Ghostscript must either be configured --without-tesseract, or its source tree have the tesseract directory deleted before building.
Comment 9 antikapitalista 2022-08-10 12:38:44 UTC
(In reply to caulier.gilles from comment #7)
> It crash in 32 bits HDRI version of imagemagick.
> 
> For the digiKam bundle we disable HDRI support in IM : 
> 
> https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/
> 3rdparty/ext_imagemagick/CMakeLists.txt#L26
> 
> It's probably a UPSTREAM bug in IM code.
> 
> Gilles Caulier

It is a conflict caused by Ghostscript. Otherwise everything seems to work with external ImageMagick with all its options enabled -- except autotrace, of course -- which appears to be some ancient abandoned piece of software with a cross-dependence on older versions of ImageMagick and I am not even sure that it is still actually supported in ImageMagick.
Comment 10 caulier.gilles 2023-05-05 04:02:24 UTC
@antikapitalista@pobox.sk 

digiKam 8.0.0 is out. This entry still valid with this release ?

Best regards

Gilles Caulier
Comment 11 caulier.gilles 2023-10-11 05:43:15 UTC
antikapitalista@pobox.sk,

What's about this file using current 8.2.0 AppImage Linux bundle ? It's
reproducible ?

https://files.kde.org/digikam/

Thanks in advance

Gilles Caulier
Comment 12 caulier.gilles 2024-03-28 07:08:46 UTC
@antikapitalista,

digiKam 8.3.0 stable version is released and available at usual place :

https://www.digikam.org/download/

Can you reproduce the dysfunction on your computer ?

Thanks in advance

Gilles Caulier