Bug 340921

Summary: Crash when entring a specific command to autostart in System Settings
Product: [Applications] systemsettings Reporter: Jiehong <email>
Component: kcm_autostartAssignee: Laurent Montel <montel>
Status: RESOLVED DUPLICATE    
Severity: crash CC: aacid, jpwhiting, kde
Priority: NOR Flags: jpwhiting: gardening+
Version: 5.1.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screencast showing the issue (here in Gnome as well)

Description Jiehong 2014-11-13 12:57:02 UTC
- What I was doing when the application crashed:
I was adding the following programme to "Autostart" in System Settings:
LC_CTYPE=zh_TW.UTF-8 emacs --xrm "emacs.UseXIM: true" --daemon

This also happens without the LC_CTYPE, and when executed or not in a terminal.

An error appears: directory does not exist.

Reproducible: Always

Steps to Reproduce:
1. Open System settings, and go to Startup and Shutdown;
2. Add a new programme in Autostart;
3. `LC_CTYPE=zh_TW.UTF-8 emacs --xrm "emacs.UseXIM: true" --daemon`;
4. Give it a name;
5. You will get the following error: "The file or folder does not exist."
6. Then System Settings crashes.

Actual Results:  
-- Backtrace:
Application: System Settings (systemsettings5), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[KCrash Handler]
#5  0x00007fa82d8d06dc in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/libQt5Core.so.5
#6  0x00007fa82789f3da in KDialogJobUiDelegate::Private::next() () from /usr/lib/libKF5JobWidgets.so.5
#7  0x00007fa82d8f12da in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#8  0x00007fa82ecf1f4c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#9  0x00007fa82ecf736e in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#10 0x00007fa82d8c170b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#11 0x00007fa82d8c36d3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
#12 0x00007fa82d918d43 in ?? () from /usr/lib/libQt5Core.so.5
#13 0x00007fa829c86a1d in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#14 0x00007fa829c86d08 in ?? () from /usr/lib/libglib-2.0.so.0
#15 0x00007fa829c86dbc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#16 0x00007fa82d919137 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#17 0x00007fa82d8bf132 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#18 0x00007fa82d8c6aec in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#19 0x000000000040e77c in main ()

Expected Results:  
The application should be saved, and System Settings should not crash.
Comment 1 Jeremy Whiting 2015-09-05 13:34:57 UTC
This one should be fun to figure out. I was able to recreate the crash following the steps you described. Then trying with systemsettings5 in gdb it doesn't crash at all :/
Comment 2 Albert Astals Cid 2015-09-26 08:46:00 UTC
I can not reproduce this crash with the following combinations
  systemsettings 5.4.1 + Qt 5.50
  systemsettings 5.3.2 + Qt 5.4.1
Could any of you please install valgrind and then run valgring systemsettings5 in a terminal, try to reproduce the crash and add here the valgrind output?
Comment 3 Jeremy Whiting 2015-09-26 13:18:47 UTC
When I run systemsettings5 in valgrind here I get this after hitting OK button:

[jeremy@chrom ~]$ valgrind systemsettings5
==19048== Memcheck, a memory error detector
==19048== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19048== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==19048== Command: systemsettings5
==19048== 
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
==19048== Syscall param writev(vector[...]) points to uninitialised byte(s)
==19048==    at 0xA97884D: ??? (in /usr/lib/libc-2.22.so)
==19048==    by 0xDE6EDA8: ??? (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xDE6F19C: ??? (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xDE6F8F6: ??? (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xDE70522: ??? (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xDE705A0: xcb_wait_for_reply (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0x17FFEA69: QXcbConnection::sync() (in /usr/lib/libQt5XcbQpa.so.5.5.0)
==19048==    by 0x1801CB4E: QXcbWindow::requestActivateWindow() (in /usr/lib/libQt5XcbQpa.so.5.5.0)
==19048==    by 0x81CBDE3: QWindow::requestActivate() (in /usr/lib/libQt5Gui.so.5.5.0)
==19048==    by 0x412E2F: SettingsBase::initApplication() (SettingsBase.cpp:126)
==19048==    by 0x4171F4: SettingsBase::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_SettingsBase.cpp:122)
==19048==    by 0x9BDEEB0: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.5.0)
==19048==  Address 0x178a369e is 4,558 bytes inside a block of size 21,152 alloc'd
==19048==    at 0x4C2AC85: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19048==    by 0xDE6E75B: xcb_connect_to_fd (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xDE72490: xcb_connect_to_display_with_auth_info (in /usr/lib/libxcb.so.1.1.0)
==19048==    by 0xD5414B9: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==19048==    by 0xD5321E1: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==19048==    by 0x180013C0: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /usr/lib/libQt5XcbQpa.so.5.5.0)
==19048==    by 0x1800704C: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /usr/lib/libQt5XcbQpa.so.5.5.0)
==19048==    by 0x17DC423C: ??? (in /usr/lib/qt/plugins/platforms/libqxcb.so)
==19048==    by 0x81B4581: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /usr/lib/libQt5Gui.so.5.5.0)
==19048==    by 0x81C07C1: QGuiApplicationPrivate::createPlatformIntegration() (in /usr/lib/libQt5Gui.so.5.5.0)
==19048==    by 0x81C16DC: QGuiApplicationPrivate::createEventDispatcher() (in /usr/lib/libQt5Gui.so.5.5.0)
==19048==    by 0x9BB3DF5: QCoreApplication::init() (in /usr/lib/libQt5Core.so.5.5.0)
==19048== 
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.
 
then it shows me a messagebox saying emacs isn't a command.
Comment 4 Jiehong 2015-09-26 14:07:50 UTC
On my side, running systemsettings5 with gdb does not lead to a crash nor a coredump.

With valgrind either.

Just launching `systemsettings5` will generate a coredump (which is 8.0 MiB in lz4, so I cannot attach it here).

This is still the case with systemsettings5 5.4.1 and Qt 5.5.0 (Archlinux).

I've tried a screencast for you to see.
Comment 5 Jiehong 2015-09-26 14:08:20 UTC
Created attachment 94730 [details]
Screencast showing the issue (here in Gnome as well)
Comment 6 David Edmundson 2015-09-26 14:27:11 UTC
That didn't crash though, which is the title of the bug report.

Are we happy that's fixed?

Rest looks like: 237137
Comment 7 Jiehong 2015-09-26 14:31:13 UTC
@David: it still crashes for me though, as seen in the screencast
Comment 8 Christoph Feck 2016-11-15 12:42:03 UTC

*** This bug has been marked as a duplicate of bug 353462 ***