Bug 252229 - graphics/ksnip dumps core
Summary: graphics/ksnip dumps core
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-kde (Team)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-28 09:13 UTC by Guido Kollerie
Modified: 2020-12-31 19:11 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guido Kollerie 2020-12-28 09:13:44 UTC
Starting ksnip 1.7.3 (installed by means of pkg) dumps core:

% ksnip                                              [127]
Unable to find any translation files for ksnip.
Unable to find any translation files for kImageAnnotator.
zsh: trace trap  ksnip

My locale specific environment variables:

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_ALL=en_US.UTF-8

Regional settings in KDE System Settings:
Language: American English (default)
Formats: Netherlands - English (en_NL) (though also tried: United States (en_US))

I noticed that some KDE application have a .qm file in /usr/local/share/locale/nl/LC_MESSAGES whereas ksnip and kImageAnnotator do not. However when I copy ksnip's and kImageAnnotator's *_nl.qm files to /usr/local/share/locale/nl/LC_MESSAGES the error and core dump still occur.
Comment 1 Guido Kollerie 2020-12-28 09:20:21 UTC
BTW Copying the ksnip's and kImageAnnotator's *.nl.qm files to /usr/local/share/locale/nl/LC_MESSAGES was a nonsensical action with my language being set to American English
Comment 2 Graham Perrin 2020-12-29 03:31:56 UTC
mowa219-gjp4-8570p% uname -sr ; ksnip
FreeBSD 13.0-CURRENT
Unable to find any translation files for ksnip.
Unable to find any translation files for kImageAnnotator.
zsh: trace trap (core dumped)  ksnip
mowa219-gjp4-8570p% uname -v         
FreeBSD 13.0-CURRENT #74 r368589: Sun Dec 13 07:55:46 GMT 2020     root@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG 
mowa219-gjp4-8570p% gdb attach ksnip.core
GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
attach: No such file or directory.
[New LWP 100580]
[New LWP 119987]
[New LWP 119988]
Core was generated by `ksnip'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x00000000002947d5 in ?? ()
[Current thread is 1 (LWP 100580)]
(gdb) bt
#0  0x00000000002947d5 in ?? ()
#1  0x00007fffffffe260 in ?? ()
#2  0x000000000028d210 in ?? ()
#3  0x0000000000000118 in ?? ()
#4  0x0000000000000000 in ?? ()
(gdb) q
mowa219-gjp4-8570p%
Comment 3 Adriaan de Groot freebsd_committer 2020-12-30 19:36:31 UTC
Confirmed here too: 13-not-so-current, KDE Plasma X11, nvidia drivers, ksnip just up and gives me

Trace/BPT trap (core dumped)

*somewhat* peculiar is that lldb seems to hang while running ksnip. Valgrind isn't functional, locally, right now.After some futzing with the build, I managed to change the output to

Illegal instruction (core dumped)

and some more futzing gets me this BT:

* thread #1, name = 'ksnip', stop reason = signal SIGILL
  * frame #0: 0x00000000002d4148 ksnip`WidgetHiderFactory::create(widget=0x0000000803a5c180) at WidgetHiderFactory.cpp:23:1
    frame #1: 0x00000000002c1d2e ksnip`MainWindow::MainWindow(this=0x0000000803a5c180, imageGrabber=0x0000000803a3fd00, mode=GUI) at MainWindow.cpp:52:15
    frame #2: 0x000000000030d0ce ksnip`StandAloneBootstrapper::createMainWindow(this=0x0000000803a6f5c0, mode=GUI) at StandAloneBootstrapper.cpp:161:20
    frame #3: 0x000000000030caa1 ksnip`StandAloneBootstrapper::startKsnip(this=0x0000000803a6f5c0, app=0x00007fffffffd390) at StandAloneBootstrapper.cpp:146:2
    frame #4: 0x000000000030c5f4 ksnip`StandAloneBootstrapper::start(this=0x0000000803a6f5c0, app=0x00007fffffffd390) at StandAloneBootstrapper.cpp:46:10
    frame #5: 0x000000000030e306 ksnip`SingleInstanceServerBootstrapper::start(this=0x0000000803a6f5c0, app=0x00007fffffffd390) at SingleInstanceServerBootstrapper.cpp:35:33
    frame #6: 0x0000000000288d11 ksnip`main(argc=1, argv=0x00007fffffffd418) at main.cpp:46:15
    frame #7: 0x000000000027d690 ksnip`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7
Comment 4 commit-hook freebsd_committer 2020-12-30 21:07:22 UTC
A commit references this bug:

Author: adridg
Date: Wed Dec 30 21:07:11 UTC 2020
New revision: 559684
URL: https://svnweb.freebsd.org/changeset/ports/559684

Log:
  Patch UB in graphics/ksnip

  Various functions did if-linux-else-windows-else-apple, leaving us behind;
  when those functions are supposed to return a value, but don't, that's
  Undefined Behavior. It's allowed to crash, or do something else. There were
  already patches adding the "other" case, here's a handful more of them.

  I chose to patch the existing port, rather than trying to chase an
  update to the recently-released 1.8.0, because that's a little less
  work *right now*.

  PR:		252229
  Reported by:	Guido Kollerie

Changes:
  head/graphics/ksnip/Makefile
  head/graphics/ksnip/files/patch-src_common_adapter_fileDialog_FileDialogAdapterFactory.cpp
  head/graphics/ksnip/files/patch-src_common_adapter_fileDialog_FileDialogAdapterFactory.h
  head/graphics/ksnip/files/patch-src_common_platform_HdpiScaler.cpp
  head/graphics/ksnip/files/patch-src_gui_widgetHider_WidgetHiderFactory.cpp
Comment 5 Graham Perrin 2020-12-31 19:11:09 UTC
Fix confirmed, thanks. 

grahamperrin@mowa219-gjp4-8570p:~ % date ; uname -v 
Thu 31 Dec 2020 19:09:52 GMT
FreeBSD 13.0-CURRENT #74 r368589: Sun Dec 13 07:55:46 GMT 2020     root@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG 
grahamperrin@mowa219-gjp4-8570p:~ % pkg query '%o %v %R' ksnip
graphics/ksnip 1.7.3_1 poudriere
grahamperrin@mowa219-gjp4-8570p:~ % du -hs /usr/local/bin/ksnip
377K    /usr/local/bin/ksnip
grahamperrin@mowa219-gjp4-8570p:~ % du -hs /usr/local/bin/spectacle
221K    /usr/local/bin/spectacle
grahamperrin@mowa219-gjp4-8570p:~ %