Bug 243267

Summary: graphics/gimp-app: 2.10.14,1 crashes on startup in gimp_restore (upgrade from 2.8-something): assert failure in json_object_object_add_ex()
Product: Ports & Packages Reporter: Marcin Cieślak <saper>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Only Me CC: fluffy, grahamperrin, saper, sunpoet
Priority: --- Keywords: crash, regression
Version: Latest   
Hardware: amd64   
OS: Any   
URL: https://gitlab.gnome.org/GNOME/gimp/issues/4491
Attachments:
Description Flags
full gdb log none

Description Marcin Cieślak 2020-01-11 12:02:48 UTC
This is FreeBSD 11.3-STABLE #0 r356413 on amd64 laptop,
after 11.3 update all packages reinstalled with pkg.

I had a relatively unclean installation of gimp 2.8 which had to be removed manually, I have also deleted $HOME/.gimp and $HOME/.config/GIMP

gimp crashes on startup:

glib version is glib-2.56.3_6,1

```
GNU Image Manipulation Program version 2.10.14
git-describe: GIMP_2_10_12-511-ga4f55d6c7e
C compiler:
	FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
	Target: x86_64-unknown-freebsd11.3
	Thread model: posix
	InstalledDir: /usr/bin

using babl version 0.1.72 (compiled against version 0.1.72)
using GEGL version 0.4.18 (compiled against version 0.4.18)
using GLib version 2.56.3 (compiled against version 2.56.3)
using GdkPixbuf version 2.40.0 (compiled against version 2.40.0)
using GTK+ version 2.24.32 (compiled against version 2.24.32)
using Pango version 1.42.3 (compiled against version 1.42.3)
using Fontconfig version 2.12.6 (compiled against version 2.12.6)
using Cairo version 1.16.0 (compiled against version 1.16.0)

```
> fatal error: Segmentation fault

Stack trace:
```

# Stack traces obtained from PID 78857 - Thread 101174 #

(lldb) process attach --pid 78857
Process 78857 stopped

Executable module set to "/usr/local/bin/gimp-2.10".
Architecture set to: x86_64--freebsd11.3.
(lldb) thread list
Process 78857 stopped
* thread #1: tid = 101174, 0x0000000806da4688 libc.so.7`_read + 8, name = 'gimp-2.10'
  thread #2: tid = 100623, 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12, name = 'gimp-2.10'
  thread #3: tid = 100851, 0x0000000806d45baa libc.so.7`__sys_poll + 10, name = 'gimp-2.10'
  thread #4: tid = 100853, 0x0000000806d45baa libc.so.7`__sys_poll + 10, name = 'gimp-2.10'
  thread #5: tid = 100854, 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12, name = 'gimp-2.10'
(lldb) thread backtrace all
* thread #1, name = 'gimp-2.10'
  * frame #0: 0x0000000806da4688 libc.so.7`_read + 8
    frame #1: 0x0000000803f97ca6 libthr.so.3`__thr_read(fd=<unavailable>, buf=<unavailable>, nbytes=<unavailable>) at thr_syscalls.c:418:8
    frame #2: 0x00000008029bed42 libgimpbase-2.0.so.0`gimp_stack_trace_print + 530
    frame #3: 0x00000000004b488c gimp-2.10`___lldb_unnamed_symbol8$$gimp-2.10 + 348
    frame #4: 0x00000000004b4726 gimp-2.10`gimp_fatal_error + 22
    frame #5: 0x00000000004b539d gimp-2.10`___lldb_unnamed_symbol9$$gimp-2.10 + 45
    frame #6: 0x0000000803f9ad70 libthr.so.3`handle_signal(actp=0x00007fffffffd4c0, sig=11, info=0x00007fffffffd8b0, ucp=0x00007fffffffd540) at thr_sig.c:246:3
    frame #7: 0x0000000803f9a33f libthr.so.3`thr_sighandler(sig=11, info=0x00007fffffffd8b0, _ucp=0x00007fffffffd540) at thr_sig.c:189:2
    frame #8: 0x00007ffffffff003
    frame #9: 0x0000000804ab1f07 libbabl-0.1.so.0`babl_process + 23
    frame #10: 0x0000000804aaf623 libbabl-0.1.so.0`___lldb_unnamed_symbol18$$libbabl-0.1.so.0 + 371
    frame #11: 0x0000000804ab24f2 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 386
    frame #12: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #13: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #14: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #15: 0x0000000804ab1914 libbabl-0.1.so.0`___lldb_unnamed_symbol61$$libbabl-0.1.so.0 + 644
    frame #16: 0x0000000804ab6934 libbabl-0.1.so.0`babl_fish + 564
    frame #17: 0x00000000008c17b5 gimp`___lldb_unnamed_symbol137$$gimp + 37
    frame #18: 0x000000000077f124 gimp-2.10`___lldb_unnamed_symbol5384$$gimp-2.10 + 100
    frame #19: 0x0000000805c0ad6d libgobject-2.0.so.0`g_closure_invoke + 189
    frame #20: 0x0000000805c1fdca libgobject-2.0.so.0`___lldb_unnamed_symbol208$$libgobject-2.0.so.0 + 1994
    frame #21: 0x0000000805c209c0 libgobject-2.0.so.0`g_signal_emit_valist + 2032
    frame #22: 0x0000000805c21054 libgobject-2.0.so.0`g_signal_emit + 116
    frame #23: 0x000000000077cc2e gimp-2.10`gimp_restore + 334
    frame #24: 0x00000000004b3ed5 gimp-2.10`app_run + 517
    frame #25: 0x00000000004b68d7 gimp-2.10`main + 855
    frame #26: 0x00000000004b3a1d gimp-2.10`_start + 141
  thread #2, name = 'gimp-2.10'
    frame #0: 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12
    frame #1: 0x0000000803f97040 libthr.so.3`_thr_umtx_timedwait_uint(mtx=<unavailable>, id=<unavailable>, clockid=<unavailable>, abstime=<unavailable>, shared=<unavailable>) at thr_umtx.c:234:10
    frame #2: 0x0000000803fa0e72 libthr.so.3`cond_wait_common [inlined] cond_wait_user(cvp=<unavailable>, mp=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:305:11
    frame #3: 0x0000000803fa0d7a libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:365
    frame #4: 0x0000000805ee10db libglib-2.0.so.0`g_cond_wait + 43
    frame #5: 0x00000008041d96d4 libgegl-0.4.so.0`___lldb_unnamed_symbol21$$libgegl-0.4.so.0 + 148
    frame #6: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #7: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa16500) at thr_create.c:290:16
  thread #3, name = 'gimp-2.10'
    frame #0: 0x0000000806d45baa libc.so.7`__sys_poll + 10
    frame #1: 0x0000000803f97bc6 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:336:8
    frame #2: 0x0000000805e99747 libglib-2.0.so.0`___lldb_unnamed_symbol117$$libglib-2.0.so.0 + 423
    frame #3: 0x0000000805e99854 libglib-2.0.so.0`g_main_context_iteration + 100
    frame #4: 0x0000000805e9b416 libglib-2.0.so.0`___lldb_unnamed_symbol122$$libglib-2.0.so.0 + 54
    frame #5: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #6: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa18300) at thr_create.c:290:16
  thread #4, name = 'gimp-2.10'
    frame #0: 0x0000000806d45baa libc.so.7`__sys_poll + 10
    frame #1: 0x0000000803f97bc6 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:336:8
    frame #2: 0x0000000805e99747 libglib-2.0.so.0`___lldb_unnamed_symbol117$$libglib-2.0.so.0 + 423
    frame #3: 0x0000000805e99aef libglib-2.0.so.0`g_main_loop_run + 223
    frame #4: 0x0000000805304aeb libgio-2.0.so.0`___lldb_unnamed_symbol1705$$libgio-2.0.so.0 + 27
    frame #5: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #6: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa18800) at thr_create.c:290:16
  thread #5, name = 'gimp-2.10'
    frame #0: 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12
    frame #1: 0x0000000803f97040 libthr.so.3`_thr_umtx_timedwait_uint(mtx=<unavailable>, id=<unavailable>, clockid=<unavailable>, abstime=<unavailable>, shared=<unavailable>) at thr_umtx.c:234:10
    frame #2: 0x0000000803fa0e72 libthr.so.3`cond_wait_common [inlined] cond_wait_user(cvp=<unavailable>, mp=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:305:11
    frame #3: 0x0000000803fa0d7a libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:365
    frame #4: 0x0000000805ee10db libglib-2.0.so.0`g_cond_wait + 43
    frame #5: 0x0000000000786b8f gimp-2.10`___lldb_unnamed_symbol5401$$gimp-2.10 + 47
    frame #6: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #7: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x0000000814323f00) at thr_create.c:290:16
(lldb) bt all
* thread #1, name = 'gimp-2.10'
  * frame #0: 0x0000000806da4688 libc.so.7`_read + 8
    frame #1: 0x0000000803f97ca6 libthr.so.3`__thr_read(fd=<unavailable>, buf=<unavailable>, nbytes=<unavailable>) at thr_syscalls.c:418:8
    frame #2: 0x00000008029bed42 libgimpbase-2.0.so.0`gimp_stack_trace_print + 530
    frame #3: 0x00000000004b488c gimp-2.10`___lldb_unnamed_symbol8$$gimp-2.10 + 348
    frame #4: 0x00000000004b4726 gimp-2.10`gimp_fatal_error + 22
    frame #5: 0x00000000004b539d gimp-2.10`___lldb_unnamed_symbol9$$gimp-2.10 + 45
    frame #6: 0x0000000803f9ad70 libthr.so.3`handle_signal(actp=0x00007fffffffd4c0, sig=11, info=0x00007fffffffd8b0, ucp=0x00007fffffffd540) at thr_sig.c:246:3
    frame #7: 0x0000000803f9a33f libthr.so.3`thr_sighandler(sig=11, info=0x00007fffffffd8b0, _ucp=0x00007fffffffd540) at thr_sig.c:189:2
    frame #8: 0x00007ffffffff003
    frame #9: 0x0000000804ab1f07 libbabl-0.1.so.0`babl_process + 23
    frame #10: 0x0000000804aaf623 libbabl-0.1.so.0`___lldb_unnamed_symbol18$$libbabl-0.1.so.0 + 371
    frame #11: 0x0000000804ab24f2 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 386
    frame #12: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #13: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #14: 0x0000000804ab2488 libbabl-0.1.so.0`___lldb_unnamed_symbol69$$libbabl-0.1.so.0 + 280
    frame #15: 0x0000000804ab1914 libbabl-0.1.so.0`___lldb_unnamed_symbol61$$libbabl-0.1.so.0 + 644
    frame #16: 0x0000000804ab6934 libbabl-0.1.so.0`babl_fish + 564
    frame #17: 0x00000000008c17b5 gimp`___lldb_unnamed_symbol137$$gimp + 37
    frame #18: 0x000000000077f124 gimp-2.10`___lldb_unnamed_symbol5384$$gimp-2.10 + 100
    frame #19: 0x0000000805c0ad6d libgobject-2.0.so.0`g_closure_invoke + 189
    frame #20: 0x0000000805c1fdca libgobject-2.0.so.0`___lldb_unnamed_symbol208$$libgobject-2.0.so.0 + 1994
    frame #21: 0x0000000805c209c0 libgobject-2.0.so.0`g_signal_emit_valist + 2032
    frame #22: 0x0000000805c21054 libgobject-2.0.so.0`g_signal_emit + 116
    frame #23: 0x000000000077cc2e gimp-2.10`gimp_restore + 334
    frame #24: 0x00000000004b3ed5 gimp-2.10`app_run + 517
    frame #25: 0x00000000004b68d7 gimp-2.10`main + 855
    frame #26: 0x00000000004b3a1d gimp-2.10`_start + 141
  thread #2, name = 'gimp-2.10'
    frame #0: 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12
    frame #1: 0x0000000803f97040 libthr.so.3`_thr_umtx_timedwait_uint(mtx=<unavailable>, id=<unavailable>, clockid=<unavailable>, abstime=<unavailable>, shared=<unavailable>) at thr_umtx.c:234:10
    frame #2: 0x0000000803fa0e72 libthr.so.3`cond_wait_common [inlined] cond_wait_user(cvp=<unavailable>, mp=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:305:11
    frame #3: 0x0000000803fa0d7a libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:365
    frame #4: 0x0000000805ee10db libglib-2.0.so.0`g_cond_wait + 43
    frame #5: 0x00000008041d96d4 libgegl-0.4.so.0`___lldb_unnamed_symbol21$$libgegl-0.4.so.0 + 148
    frame #6: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #7: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa16500) at thr_create.c:290:16
  thread #3, name = 'gimp-2.10'
    frame #0: 0x0000000806d45baa libc.so.7`__sys_poll + 10
    frame #1: 0x0000000803f97bc6 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:336:8
    frame #2: 0x0000000805e99747 libglib-2.0.so.0`___lldb_unnamed_symbol117$$libglib-2.0.so.0 + 423
    frame #3: 0x0000000805e99854 libglib-2.0.so.0`g_main_context_iteration + 100
    frame #4: 0x0000000805e9b416 libglib-2.0.so.0`___lldb_unnamed_symbol122$$libglib-2.0.so.0 + 54
    frame #5: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #6: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa18300) at thr_create.c:290:16
  thread #4, name = 'gimp-2.10'
    frame #0: 0x0000000806d45baa libc.so.7`__sys_poll + 10
    frame #1: 0x0000000803f97bc6 libthr.so.3`__thr_poll(fds=<unavailable>, nfds=<unavailable>, timeout=<unavailable>) at thr_syscalls.c:336:8
    frame #2: 0x0000000805e99747 libglib-2.0.so.0`___lldb_unnamed_symbol117$$libglib-2.0.so.0 + 423
    frame #3: 0x0000000805e99aef libglib-2.0.so.0`g_main_loop_run + 223
    frame #4: 0x0000000805304aeb libgio-2.0.so.0`___lldb_unnamed_symbol1705$$libgio-2.0.so.0 + 27
    frame #5: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #6: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x000000080fa18800) at thr_create.c:290:16
  thread #5, name = 'gimp-2.10'
    frame #0: 0x0000000803fa316c libthr.so.3`_umtx_op_err + 12
    frame #1: 0x0000000803f97040 libthr.so.3`_thr_umtx_timedwait_uint(mtx=<unavailable>, id=<unavailable>, clockid=<unavailable>, abstime=<unavailable>, shared=<unavailable>) at thr_umtx.c:234:10
    frame #2: 0x0000000803fa0e72 libthr.so.3`cond_wait_common [inlined] cond_wait_user(cvp=<unavailable>, mp=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:305:11
    frame #3: 0x0000000803fa0d7a libthr.so.3`cond_wait_common(cond=<unavailable>, mutex=<unavailable>, abstime=0x0000000000000000, cancel=1) at thr_cond.c:365
    frame #4: 0x0000000805ee10db libglib-2.0.so.0`g_cond_wait + 43
    frame #5: 0x0000000000786b8f gimp-2.10`___lldb_unnamed_symbol5401$$gimp-2.10 + 47
    frame #6: 0x0000000805ec196a libglib-2.0.so.0`___lldb_unnamed_symbol220$$libglib-2.0.so.0 + 90
    frame #7: 0x0000000803f950b6 libthr.so.3`thread_start(curthread=0x0000000814323f00) at thr_create.c:290:16

```
Comment 1 Marcin Cieślak 2020-01-11 12:07:36 UTC
Potential upstream issue:

https://gitlab.gnome.org/GNOME/gimp/issues/4392
Comment 2 Marcin Cieślak 2020-01-11 15:06:13 UTC
unlikely to be    
https://gitlab.gnome.org/GNOME/gimp/issues/4392 since our glib is older
Comment 3 Marcin Cieślak 2020-01-12 21:49:50 UTC
Created attachment 210668 [details]
full gdb log

Command: env LANG=C gdb831 --args /usr/local/bin/gimp-2.10 --verbose --console-messages --debug-handlers

produces the following backtrace:

Loading 'mypaint brush factory' data
  Loading /usr/local/share/mypaint-data/1.0/brushes/classic/blend+paint.myb
Assertion failed: (json_object_get_type(jso) == json_type_object), function json_object_object_add_ex, file json_object.c, line 476.

Thread 1 received signal SIGABRT, Aborted.
0x0000000807139aea in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x0000000807139aea in thr_kill () at /lib/libc.so.7
#1  0x0000000807139ab4 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000807139a29 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
#3  0x00000008071b5101 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>) at /usr/src/lib/libc/gen/assert.c:51
#4  0x0000000805e0fef5 in json_object_object_add_ex (jso=0x81c6fcc00, key=0x81d9ff228 "comment", val=0x81c6fcc60, opts=0) at json_object.c:476
#5  0x0000000805e10077 in json_object_object_add (jso=0x81c6fcc00, key=0x81d9ff228 "comment", val=0x81c6fcc60) at json_object.c:508
#6  0x0000000805e17b64 in json_tokener_parse_ex
    (tok=0x81eb46340, str=0x81e643c25 ", \n    \"group\": \"\", \n    \"parent_brush_name\": \"\", \n    \"settings\": {\n        \"anti_aliasing\": {\n", ' ' <repeats 12 times>, "\"base_value\": 0.0, \n", ' ' <repeats 12 times>, "\"inputs\": {}\n        }, \n        \"change_color_h\": {\n       "..., len=-1) at json_tokener.c:930
#7  0x0000000805e14013 in json_tokener_parse_verbose
    (str=0x81e643c00 "{\n    \"comment\": \"MyPaint brush file\", \n    \"group\": \"\", \n    \"parent_brush_name\": \"\", \n    \"settings\": {\n        \"anti_aliasing\": {\n", ' ' <repeats 12 times>, "\"base_value\": 0.0, \n", ' ' <repeats 12 times>, "\"inputs\": {}\n        },"..., error=0x7fffffffde04) at json_tokener.c:179
#8  0x0000000805e13f97 in json_tokener_parse
    (str=0x81e643c00 "{\n    \"comment\": \"MyPaint brush file\", \n    \"group\": \"\", \n    \"parent_brush_name\": \"\", \n    \"settings\": {\n        \"anti_aliasing\": {\n", ' ' <repeats 12 times>, "\"base_value\": 0.0, \n", ' ' <repeats 12 times>, "\"inputs\": {}\n        },"...) at json_tokener.c:166
#9  0x0000000805bfe160 in mypaint_brush_from_string
    (self=0x81e5d4300, string=0x81e643c00 "{\n    \"comment\": \"MyPaint brush file\", \n    \"group\": \"\", \n    \"parent_brush_name\": \"\", \n    \"settings\": {\n        \"anti_aliasing\": {\n", ' ' <repeats 12 times>, "\"base_value\": 0.0, \n", ' ' <repeats 12 times>, "\"inputs\": {}\n        },"...) at mypaint-brush.c:1218
#10 0x0000000000a899df in gimp_mybrush_load (context=0x80ffe4250, file=0x81c7bbd20, input=0x81e19bbf0, error=0x7fffffffe0b0) at gimpmybrush-load.c:90
#11 0x00000000009d5373 in gimp_data_loader_factory_load_data (factory=0x80ffb19f0, context=0x80ffe4250, cache=0x0, dir_writable=0, file=0x81c7bbd20, info=0x81c7bb630, top_directory=0x81e1de3a0) at gimpdataloaderfactory.c:453
#12 0x00000000009d513b in gimp_data_loader_factory_load_directory (factory=0x80ffb19f0, context=0x80ffe4250, cache=0x0, dir_writable=0, directory=0x81c7bbc80, top_directory=0x81e1de3a0) at gimpdataloaderfactory.c:385
#13 0x00000000009d5108 in gimp_data_loader_factory_load_directory (factory=0x80ffb19f0, context=0x80ffe4250, cache=0x0, dir_writable=0, directory=0x81e1de3a0, top_directory=0x81e1de3a0) at gimpdataloaderfactory.c:378
#14 0x00000000009d4fc3 in gimp_data_loader_factory_load (factory=0x80ffb19f0, context=0x80ffe4250, cache=0x0) at gimpdataloaderfactory.c:330
#15 0x00000000009d4e51 in gimp_data_loader_factory_data_init (factory=0x80ffb19f0, context=0x80ffe4250) at gimpdataloaderfactory.c:143
#16 0x00000000009d1244 in gimp_data_factory_data_init (factory=0x80ffb19f0, context=0x80ffe4250, no_data=0) at gimpdatafactory.c:488
#17 0x0000000000972f2a in gimp_data_factories_load (gimp=0x80ff78070, status_callback=0x513f20 <splash_update>) at gimp-data-factories.c:360
#18 0x000000000096c87c in gimp_restore (gimp=0x80ff78070, status_callback=0x513f20 <splash_update>, error=0x7fffffffe590) at gimp.c:790
#19 0x0000000000508301 in app_run
    (full_prog_name=0x80fe1d4e0 "/usr/local/bin/gimp-2.10", filenames=0x0, alternate_system_gimprc=0x0, alternate_gimprc=0x0, session_name=0x0, batch_interpreter=0x0, batch_commands=0x0, as_new=0, no_interface=0, no_data=0, no_fonts=0, no_splash=0, be_verbose=1, use_shm=1, use_cpu_accel=1, console_messages=1, use_debug_handler=1, show_playground=0, show_debug_menu=0, stack_trace_mode=GIMP_STACK_TRACE_NEVER, pdb_compat_mode=GIMP_PDB_COMPAT_ON, backtrace_file=0x80fe3f080 "/home/saper/.config/GIMP/2.10/CrashLog/GIMP-crash-1578863931.txt") at app.c:330
#20 0x000000000050c1ee in main (argc=4, argv=0x80fe31870) at main.c:531


The brush seems to come from

/usr/local/share/mypaint-data/1.0/brushes/classic/blend+paint.myb

and belongs to

$ pkg which /usr/local/share/mypaint-data/1.0/brushes/classic/blend+paint.myb
/usr/local/share/mypaint-data/1.0/brushes/classic/blend+paint.myb was installed by package mypaint-brushes-1.3.0

jq confirms this is a valid JSON file.

This could be the following assertion in json-c library:


        assert(json_object_get_type(jso) == json_type_object);


https://github.com/json-c/json-c/blob/json-c-0.13.1-20180305/json_object.c#L476
Comment 4 Marcin Cieślak 2020-01-12 22:00:56 UTC
tried side stepping through the function:

it seems that json_object_get_type() gets loaded from 

/usr/local/lib/libjson-glib-1.0.so.0

> pkg which /usr/local/lib/libjson-glib-1.0.so.0
/usr/local/lib/libjson-glib-1.0.so.0 was installed by package json-glib-1.4.4

Both are referred to from the gimp binary:

> ldd /usr/local/bin/gimp-2.10 |grep json	
        libjson-glib-1.0.so.0 => /usr/local/lib/libjson-glib-1.0.so.0 (0x804c93000)
	libjson-c.so.4 => /usr/local/lib/libjson-c.so.4 (0x805e0a000)


radziecki> objdump -T /usr/local/lib/libjson-c.so.4 | grep json_object_get_type
0000000000005240 g    DF .text	000000000000002d  Base        json_object_get_type
radziecki> objdump -T /usr/local/lib/libjson-glib-1.0.so | grep json_object_get_type
0000000000014d70 g    DF .text	000000000000005b  Base        json_object_get_type


wow.
Comment 5 Marcin Cieślak 2020-01-12 22:50:29 UTC
Filed https://gitlab.gnome.org/GNOME/gimp/issues/4491 with gimp and also https://github.com/json-c/json-c/issues/534 with the json-c library.

Probably those libraries should CONFLICT with each other, but then we will not be able to build gimp :/
Comment 6 Marcin Cieślak 2020-01-12 23:10:16 UTC
Quick workaround:

apply this patch to devel/json-c/Makefile:

--- Makefile.bak	2020-01-12 23:59:28.538313000 +0100
+++ Makefile	2020-01-13 00:01:38.408512000 +0100
@@ -25,6 +25,10 @@
 
 post-patch:
 	@${REINPLACE_CMD} -e 's| -Werror||g' ${WRKSRC}/Makefile.in
+	@cd ${WRKSRC}; \
+		${FIND} . -name '*.[hc]' -type f \
+		-exec ${SED} -i '' -e "s,json_object_get_type,own_json_object_get_type,g" {} +
+
 
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/json_object_private.h ${STAGEDIR}${PREFIX}/include/json-c/
Comment 7 Marcin Cieślak 2020-01-13 00:41:04 UTC
This bug seems to be reproduceable only if json-c is built without -O2 (I was using WITH_DEBUG=yes which removes -O2), see https://gitlab.gnome.org/GNOME/gimp/issues/4491#note_684094
Comment 8 Marcin Cieślak 2020-01-13 12:35:41 UTC
(In reply to Marcin Cieślak from comment #0)
The original crash as reported in the comment #0 was a different thing. I got this heisenbug when building everything WITH_DEBUG set to true. The original crash was there because unpackaged /usr/local/lib/babl-0.1/16bit.so was there as a leftover from the previous gimp installation.

Therefore this bug reports concerns the second json-c related crash only.
Comment 9 Dima Panov freebsd_committer freebsd_triage 2022-01-10 08:43:37 UTC
Is it still actual?
Comment 10 Marcin Cieślak 2022-01-10 20:30:12 UTC
Let's see, I will try to reproduce it again.
Comment 11 Marcin Cieślak 2022-01-10 21:21:05 UTC
There is a good chance it got resolved. As of 0.15, json-c has versioned symbols:

> objdump -T /usr/local/lib/libjson-c.so.5 | grep json_object_get_type
0000000000004d30 g    DF .text	000000000000002d  JSONC_0.14  json_object_get_type

> objdump -T /usr/local/lib/libjson-glib-1.0.so.0.600.2 | grep json_object_get_type
0000000000015aa0 g    DF .text	000000000000003d  Base        json_object_get_type

https://github.com/json-c/json-c/commit/c2c94024f5d15c2fe36c72cb139df6a2ccd9b3ec
2.10.24,2
https://github.com/json-c/json-c/issues/621

Right now I can start gimp-2.10.24,2 from pkg against json-c 0.15 built WITH_DEBUG=yes from ports.

Let's see if recompiled gimp works fine
Comment 12 Marcin Cieślak 2022-01-10 21:21:22 UTC
There is a good chance it got resolved. As of 0.15, json-c has versioned symbols:

> objdump -T /usr/local/lib/libjson-c.so.5 | grep json_object_get_type
0000000000004d30 g    DF .text	000000000000002d  JSONC_0.14  json_object_get_type

> objdump -T /usr/local/lib/libjson-glib-1.0.so.0.600.2 | grep json_object_get_type
0000000000015aa0 g    DF .text	000000000000003d  Base        json_object_get_type

https://github.com/json-c/json-c/commit/c2c94024f5d15c2fe36c72cb139df6a2ccd9b3ec
2.10.24,2
https://github.com/json-c/json-c/issues/621

Right now I can start gimp-2.10.24,2 from pkg against json-c 0.15 built WITH_DEBUG=yes from ports.

Let's see if recompiled gimp works fine
Comment 13 Graham Perrin freebsd_committer freebsd_triage 2022-10-22 06:41:31 UTC
Please, is this still an issue?

(In reply to Dima Panov from comment #9)

(In reply to Marcin Cieślak from comment #11 and comment #12)

> … Let's see if recompiled gimp works fine
Comment 14 Marcin Cieślak 2022-10-22 11:36:23 UTC
With gimp 2.10.30, json-glib 1.6.6 json-c 0.16, all built from source, this no longer happens. I believe this was fixed by json-c 0.16 adding symbol versioning there.

Gimp might want to enforce 0.16 as the minimal version of json-c.

Closing this.