Bug 416380

Summary: kdiff3 Segmentation fault (core dumped) when used to diff 2 files
Product: [Applications] kdiff3 Reporter: Satish Balay <balay>
Component: applicationAssignee: michael <reeves.87>
Status: RESOLVED UPSTREAM    
Severity: crash CC: vascom2
Priority: NOR    
Version: 1.8.x   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
URL: https://bugzilla.redhat.com/show_bug.cgi?id=1770512
Latest Commit: Version Fixed In:
Attachments: kdiff3 valgrind log
kdiff3 valgrind log (with debug symbols installed)

Description Satish Balay 2020-01-17 14:04:58 UTC
SUMMARY

kdiff3 segfaults when used to diff 2 files

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1770512

STEPS TO REPRODUCE
1. Login with gnome/wayland
2. kdiff3 .bashrc .bash_profile
3. menu  file -> quit

OBSERVED RESULT

$ kdiff3 .bashrc .bash_profile 
QSocketNotifier: Can only be used with threads started with QThread
Segmentation fault (core dumped)

EXPECTED RESULT

No crash

SOFTWARE/OS VERSIONS
Fedora 31 with gnome/wayland

glibc-2.30-8.fc31.x86_64
kdiff3-1.8.1-4.fc31.x86_64
qgnomeplatform-0.6.0-2.fc31.x86_64
qt5-qtbase-5.13.2-1.fc31.x86_64
qt5-qtbase-gui-5.13.2-1.fc31.x86_64
qt5-qtwayland-5.13.2-2.fc31.x86_64

ADDITIONAL INFORMATION

kdiff3 does not crash when login via gnome/xorg

This issue came up primarily when using kdiff3  via 'git mergetool'. i.e after merge is done 'save' and 'quit' crashes kdiff3 - and git aborts
Work-around [for git mergetool usage] is:
- do merge in kdiff3
- [do not save]
- quit
- now a dialog box prompts to 'save and quit' - so click this dialog box.
Comment 1 Satish Balay 2020-01-17 14:05:53 UTC
$ gdb kdiff3
GNU gdb (GDB) Fedora 8.3.50.20190824-26.fc31
Copyright (C) 2019 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-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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"...
Reading symbols from kdiff3...
Reading symbols from .gnu_debugdata for /usr/bin/kdiff3...
(No debugging symbols found in .gnu_debugdata for /usr/bin/kdiff3)
Missing separate debuginfos, use: dnf debuginfo-install kdiff3-1.8.1-4.fc31.x86_64
(gdb) r .bashrc .bash_profile 
Starting program: /usr/bin/kdiff3 .bashrc .bash_profile
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe5a92700 (LWP 6322)]
QSocketNotifier: Can only be used with threads started with QThread
[New Thread 0x7fffdf79e700 (LWP 6324)]
[New Thread 0x7fffdef9d700 (LWP 6325)]
[New Thread 0x7fffde79c700 (LWP 6326)]
[New Thread 0x7fffddf9b700 (LWP 6327)]
[New Thread 0x7fffcaae8700 (LWP 6328)]
[New Thread 0x7fffc92e8700 (LWP 6329)]
[New Thread 0x7fffc8ae7700 (LWP 6330)]

Thread 1 "kdiff3" received signal SIGSEGV, Segmentation fault.
0x00007ffff624d26e in malloc () from /lib64/libc.so.6
(gdb) where
#0  0x00007ffff624d26e in malloc () from /lib64/libc.so.6
#1  0x00007ffff657b059 in operator new(unsigned long) () from /lib64/libstdc++.so.6
#2  0x00007ffff6962cb8 in QObject::deleteLater() () from /lib64/libQt5Core.so.5
#3  0x00007fffdd5ce6b8 in Adwaita::BaseDataMap<QObject, Adwaita::WidgetStateData>::unregisterWidget(QObject const*) () from /usr/lib64/qt5/plugins/styles/adwaita.so
#4  0x00007fffdd5c838c in Adwaita::WidgetStateEngine::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.0] ()
   from /usr/lib64/qt5/plugins/styles/adwaita.so
#5  0x00007ffff696498b in QMetaObject::activate(QObject*, int, int, void**) () from /lib64/libQt5Core.so.5
#6  0x00007ffff6965113 in QObject::destroyed(QObject*) () from /lib64/libQt5Core.so.5
#7  0x00007ffff72eb653 in QWidget::~QWidget() () from /lib64/libQt5Widgets.so.5
#8  0x00007ffff7308ae1 in QDesktopScreenWidget::~QDesktopScreenWidget() () from /lib64/libQt5Widgets.so.5
#9  0x00007ffff73090f6 in QDesktopWidgetPrivate::~QDesktopWidgetPrivate() () from /lib64/libQt5Widgets.so.5
#10 0x00007ffff696c857 in QObject::~QObject() () from /lib64/libQt5Core.so.5
#11 0x00007ffff72eb73e in QWidget::~QWidget() () from /lib64/libQt5Widgets.so.5
#12 0x00007ffff73071dd in QDesktopWidget::~QDesktopWidget() () from /lib64/libQt5Widgets.so.5
#13 0x00007ffff72ad2d0 in QApplication::~QApplication() () from /lib64/libQt5Widgets.so.5
#14 0x000055555558bdad in main ()
(gdb)
Comment 2 Satish Balay 2020-01-17 14:07:15 UTC
Created attachment 125195 [details]
kdiff3 valgrind log

$ valgrind -q --tool=memcheck  --num-callers=30 --track-origins=yes --log-file=kdiff3-val.log kdiff3 .bashrc .bash_profile
Comment 3 michael 2020-01-17 20:35:04 UTC
Could you please verify this is still the case with the current 1.8 branch. Also you need to install debug symbols for kdiff3 or I cann't tell you much other than it works for me.
Comment 4 Satish Balay 2020-01-17 20:52:45 UTC
$ gdb kdiff3
GNU gdb (GDB) Fedora 8.3.50.20190824-26.fc31
Copyright (C) 2019 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-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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"...
Reading symbols from kdiff3...
Reading symbols from /usr/lib/debug/usr/bin/kdiff3-1.8.1-4.fc31.x86_64.debug...
(gdb) r .bashrc .bash_profile 
Starting program: /usr/bin/kdiff3 .bashrc .bash_profile
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.30-8.fc31.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe5a92700 (LWP 132839)]
QSocketNotifier: Can only be used with threads started with QThread
[New Thread 0x7fffdf79d700 (LWP 132841)]
[New Thread 0x7fffdef9c700 (LWP 132842)]
[New Thread 0x7fffde79b700 (LWP 132843)]
[New Thread 0x7fffddf9a700 (LWP 132844)]
[New Thread 0x7fffceae8700 (LWP 132845)]
[New Thread 0x7fffcce2c700 (LWP 132846)]
[New Thread 0x7fffc3767700 (LWP 132847)]

Thread 1 "kdiff3" received signal SIGSEGV, Segmentation fault.
0x00007ffff624d26e in malloc () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install GConf2-3.2.6-27.fc31.x86_64 at-spi2-atk-2.34.1-1.fc31.x86_64 at-spi2-core-2.34.0-1.fc31.x86_64 atk-2.34.1-1.fc31.x86_64 bzip2-libs-1.0.8-1.fc31.x86_64 cairo-1.16.0-6.fc31.x86_64 cairo-gobject-1.16.0-6.fc31.x86_64 dbus-glib-0.110-6.fc31.x86_64 dbus-libs-1.12.16-3.fc31.x86_64 dconf-0.34.0-1.fc31.x86_64 expat-2.2.8-1.fc31.x86_64 fontconfig-2.13.92-3.fc31.x86_64 freetype-2.10.0-3.fc31.x86_64 fribidi-1.0.5-5.fc31.x86_64 gdk-pixbuf2-2.40.0-1.fc31.x86_64 glib2-2.62.4-1.fc31.x86_64 graphite2-1.3.13-1.fc31.x86_64 gtk3-3.24.13-1.fc31.x86_64 harfbuzz-2.6.1-2.fc31.x86_64 kf5-attica-5.64.0-1.fc31.x86_64 kf5-karchive-5.64.0-1.fc31.x86_64 kf5-kauth-5.64.0-1.fc31.x86_64 kf5-kcodecs-5.64.0-1.fc31.x86_64 kf5-kcompletion-5.64.0-1.fc31.x86_64 kf5-kconfig-core-5.64.0-1.fc31.x86_64 kf5-kconfig-gui-5.64.0-1.fc31.x86_64 kf5-kconfigwidgets-5.64.0-1.fc31.x86_64 kf5-kcoreaddons-5.64.0-1.fc31.x86_64 kf5-kcrash-5.64.0-1.fc31.x86_64 kf5-kdbusaddons-5.64.0-1.fc31.x86_64 kf5-kglobalaccel-libs-5.64.0-1.fc31.x86_64 kf5-kguiaddons-5.64.0-1.fc31.x86_64 kf5-ki18n-5.64.0-1.fc31.x86_64 kf5-kiconthemes-5.64.0-1.fc31.x86_64 kf5-kio-core-libs-5.64.0-1.fc31.x86_64 kf5-kio-widgets-libs-5.64.0-1.fc31.x86_64 kf5-kjobwidgets-5.64.0-1.fc31.x86_64 kf5-kparts-5.64.0-1.fc31.x86_64 kf5-kservice-5.64.0-1.fc31.x86_64 kf5-ktextwidgets-5.64.0-1.fc31.x86_64 kf5-kwidgetsaddons-5.64.0-1.fc31.x86_64 kf5-kwindowsystem-5.64.0-1.fc31.x86_64 kf5-kxmlgui-5.64.0-2.fc31.x86_64 kf5-sonnet-core-5.64.0-1.fc31.x86_64 kf5-sonnet-ui-5.64.0-1.fc31.x86_64 libX11-1.6.9-2.fc31.x86_64 libX11-xcb-1.6.9-2.fc31.x86_64 libXau-1.0.9-2.fc31.x86_64 libXcomposite-0.4.4-17.fc31.x86_64 libXcursor-1.1.15-6.fc31.x86_64 libXdamage-1.1.4-17.fc31.x86_64 libXext-1.3.4-2.fc31.x86_64 libXfixes-5.0.3-10.fc31.x86_64 libXi-1.7.10-2.fc31.x86_64 libXinerama-1.1.4-4.fc31.x86_64 libacl-2.2.53-4.fc31.x86_64 libattr-2.4.48-7.fc31.x86_64 libblkid-2.34-4.fc31.x86_64 libdatrie-0.2.9-10.fc31.x86_64 libepoxy-1.5.3-4.fc31.x86_64 libgcrypt-1.8.5-1.fc31.x86_64 libglvnd-1.1.1-5.fc31.x86_64 libglvnd-glx-1.1.1-5.fc31.x86_64 libgpg-error-1.36-2.fc31.x86_64 libicu-63.2-3.fc31.x86_64 libpciaccess-0.15-2.fc31.x86_64 libpng-1.6.37-2.fc31.x86_64 libselinux-2.9-5.fc31.x86_64 libstdc++-9.2.1-1.fc31.x86_64 libthai-0.1.28-3.fc31.x86_64 libwayland-client-1.17.0-2.fc31.x86_64 libwayland-cursor-1.17.0-2.fc31.x86_64 libwayland-egl-1.17.0-2.fc31.x86_64 libxcb-1.13.1-3.fc31.x86_64 libxkbcommon-0.9.1-3.fc31.x86_64 libxshmfence-1.3-5.fc31.x86_64 lz4-libs-1.9.1-1.fc31.x86_64 mesa-dri-drivers-19.2.8-1.fc31.x86_64 mesa-libglapi-19.2.8-1.fc31.x86_64 openssl-libs-1.1.1d-2.fc31.x86_64 pcre-8.43-2.fc31.1.x86_64 qt5-qtspeech-5.13.2-1.fc31.x86_64 qt5-qtsvg-5.13.2-1.fc31.x86_64 qt5-qtx11extras-5.13.2-1.fc31.x86_64 systemd-libs-243.5-1.fc31.x86_64 xcb-util-keysyms-0.4.0-11.fc31.x86_64 xz-libs-5.2.4-6.fc31.x86_64
(gdb) where
#0  0x00007ffff624d26e in malloc () from /lib64/libc.so.6
#1  0x00007ffff657b059 in operator new(unsigned long) () from /lib64/libstdc++.so.6
#2  0x00007ffff6962cb8 in QObject::deleteLater (this=0x555555f1d560) at kernel/qobject.cpp:2199
#3  0x00007fffdd5cd6b8 in Adwaita::BaseDataMap<QObject, Adwaita::WidgetStateData>::unregisterWidget (this=this@entry=0x5555557de548, key=<optimized out>, 
    key@entry=0x5555557f72c0) at /usr/include/c++/9/bits/atomic_base.h:413
#4  0x00007fffdd5c738c in Adwaita::WidgetStateEngine::unregisterWidget (object=0x5555557f72c0, this=0x5555557de4d0)
    at /usr/src/debug/adwaita-qt-1.1.1-2.fc31.x86_64/x86_64-redhat-linux-gnu-qt5/style/adwaita-qt5_autogen/4NBMFDNHZT/../../../../style/animations/adwaitawidgetstateengine.h:137
#5  Adwaita::WidgetStateEngine::unregisterWidget (object=0x5555557f72c0, this=0x5555557de4d0)
    at /usr/src/debug/adwaita-qt-1.1.1-2.fc31.x86_64/x86_64-redhat-linux-gnu-qt5/style/adwaita-qt5_autogen/4NBMFDNHZT/../../../../style/animations/adwaitawidgetstateengine.h:131
#6  Adwaita::WidgetStateEngine::qt_static_metacall (_o=0x5555557de4d0, _a=0x7fffffffde20, _id=<optimized out>, _c=<optimized out>)
    at /usr/src/debug/adwaita-qt-1.1.1-2.fc31.x86_64/x86_64-redhat-linux-gnu-qt5/style/adwaita-qt5_autogen/4NBMFDNHZT/moc_adwaitawidgetstateengine.cpp:73
#7  0x00007ffff696498b in QMetaObject::activate (sender=0x5555557f72c0, signalOffset=<optimized out>, local_signal_index=<optimized out>, 
    argv=<optimized out>) at kernel/qobject.cpp:3809
#8  0x00007ffff6965113 in QObject::destroyed (this=this@entry=0x5555557f72c0, _t1=<optimized out>, _t1@entry=0x5555557f72c0) at .moc/moc_qobject.cpp:219
#9  0x00007ffff72eb653 in QWidget::~QWidget (this=0x5555557f72c0, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1662
#10 0x00007ffff7308ae1 in QDesktopScreenWidget::~QDesktopScreenWidget (this=0x5555557f72c0, __in_chrg=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:167
#11 QDesktopScreenWidget::~QDesktopScreenWidget (this=0x5555557f72c0, __in_chrg=<optimized out>) at kernel/qdesktopwidget_p.h:63
#12 0x00007ffff73090f6 in qDeleteAll<QList<QDesktopScreenWidget*>::const_iterator> (end=..., begin=...)
    at ../../include/QtCore/../../src/corelib/tools/qalgorithms.h:319
#13 qDeleteAll<QList<QDesktopScreenWidget*> > (c=...) at ../../include/QtCore/../../src/corelib/tools/qalgorithms.h:328
#14 QDesktopWidgetPrivate::~QDesktopWidgetPrivate (this=0x5555557178a0, __in_chrg=<optimized out>) at kernel/qdesktopwidget_p.h:85
#15 QDesktopWidgetPrivate::~QDesktopWidgetPrivate (this=0x5555557178a0, __in_chrg=<optimized out>) at kernel/qdesktopwidget_p.h:85
#16 0x00007ffff696c857 in QScopedPointerDeleter<QObjectData>::cleanup (pointer=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:52
#17 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer (this=0x555555d72378, __in_chrg=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:107
#18 QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:891
#19 0x00007ffff72eb73e in QWidget::~QWidget (this=0x555555d72370, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1718
#20 0x00007ffff73071dd in QDesktopWidget::~QDesktopWidget (this=0x555555d72370, __in_chrg=<optimized out>) at kernel/qdesktopwidget.cpp:217
#21 0x00007ffff72ad2d0 in QApplication::~QApplication() () at kernel/qapplication.cpp:802
#22 0x000055555558bdad in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdiff3-1.8.1-4.fc31.x86_64/src/main.cpp:178
(gdb)
Comment 5 Satish Balay 2020-01-17 20:53:25 UTC
Created attachment 125207 [details]
kdiff3 valgrind log (with debug symbols installed)
Comment 6 Satish Balay 2020-01-17 20:55:33 UTC
If @vascom can build latest kdiff3 1.8 branch in fedora koji - I can retry with it
Comment 7 michael 2020-01-18 00:56:14 UTC
Thanks f1d89a50afb92cb2596f827f1d0e2e30ebee3d6b will definitely fix the valgrind warnings inside kdiff3 OptionNum. However, the crash itself seems to be an issue inside QtWaylandClient.
Comment 8 Satish Balay 2020-01-18 15:47:05 UTC
Thanks! I switched https://bugzilla.redhat.com/show_bug.cgi?id=1770512 from kdiff3 to qt5-qtwayland
Comment 9 Satish Balay 2020-01-18 15:55:23 UTC
the error goes away with:

$ QT_QPA_PLATFORM=xcb kdiff3 .bashrc .bash_profile


Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1787003
Comment 10 michael 2020-01-18 16:41:58 UTC
The information in https://bugzilla.redhat.com/show_bug.cgi?id=1770512

Confirms my suspicions that this bug
is not a kdiff3 issue. The crash is inside Qt code. I am not reasonably able to work around this type of issue.