! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
mousepad core dumps with invalid command line option: Mousepad-ERROR **: Unkn...
Status:
RESOLVED: FIXED
Product:
Mousepad
Component:
General

Comments

Description Steve 2016-01-19 23:20:11 CET
Created attachment 6581 
gdb session with backtrace

Reproduce with:
$ mousepad --foo

(mousepad:17672): Mousepad-ERROR **: Unknown option --foo
Trace/breakpoint trap (core dumped)

Fedora 23:
$ rpm -q mousepad gtk2 glib2
mousepad-0.4.0-4.fc23.x86_64
gtk2-2.24.29-1.fc23.x86_64
glib2-2.46.2-1.fc23.x86_64
Comment 1 Steve 2016-01-19 23:33:26 CET
This bug appears to have been reported before against Fedora:

Bug 965933 - [abrt] mousepad-0.3.0-1.fc18: main: Process /usr/bin/mousepad was killed by signal 5 (SIGTRAP)
https://bugzilla.redhat.com/show_bug.cgi?id=965933

This may be related:

Bug 989563 - [abrt] mousepad-0.3.0-2.fc19: main: Process /usr/bin/mousepad was killed by signal 5 (SIGTRAP)
https://bugzilla.redhat.com/show_bug.cgi?id=989563
Comment 2 Andre Miranda editbugs 2016-01-20 14:38:57 CET
Created attachment 6583 
Fix patch

Here's the patch to fix this problem.
Comment 3 Steve 2016-01-23 09:17:56 CET
(In reply to André Miranda from comment #2)
> Created attachment 6583 
> Fix patch
> 
> Here's the patch to fix this problem.

Thanks, André. I rebuilt mousepad[1] with your patch applied and can confirm that it fixes the problem for both cases in Comment 1.

Case 1 (in an Xfce terminal):
Unpatched:
$ mousepad --foo

(mousepad:28286): Mousepad-ERROR **: Unknown option --foo
Trace/breakpoint trap (core dumped)

Patched:
$ ./mousepad --foo
Unknown option --foo

Case 2 (in a console):
Unpatched:
$ mousepad

(mousepad:6911): Mousepad-ERROR **: Cannot open display:
[ 5656.983159] traps: mousepad[6911] trap int3 ip:7f75ca73b81b sp:7ffdc495eeb0 error:0
[ 5656.983852] NOHZ: local_softirq_pending 02
Trace/breakpoint trap (core dumped)

Patched:
$ ./mousepad
Cannot open display:

[1] Fedora source: mousepad-0.4.0-4.fc23.src.rpm
Comment 4 Steve 2016-01-23 09:30:02 CET
There are two other calls to g_error() in main.c after applying the patch:

$ grep -n 'g_error[^_]' main.c
121:          g_error ("Failed to terminate a running instance: %s\n", error->message);
149:              g_error ("Mousepad: %s\n", error->message);
Comment 5 Andre Miranda editbugs 2016-01-23 16:10:44 CET
Created attachment 6585 
Fix patch 2

Patch updated.
I'm not really sure those two errors are meant to just print a message on stderr and exit. There are others logging functions(macros) besides g_errors that don't result in a core dump[1].

1 - https://developer.gnome.org/glib/stable/glib-Message-Logging.html
Comment 6 Steve 2016-01-24 16:57:31 CET
(In reply to André Miranda from comment #5)
...
> Patch updated.
> I'm not really sure those two errors are meant to just print a message on
> stderr and exit.
...

Good point. It might be better to simply fix the known bugs in Comment 1 and leave a review of the other g_error() calls in mousepad to a separate bug report.

$ grep -Rl 'g_error[^_]' mousepad-0.4.0/
mousepad-0.4.0/mousepad/mousepad-prefs-dialog.c
mousepad-0.4.0/mousepad/main.c
mousepad-0.4.0/mousepad/mousepad-dbus.c
Comment 7 Alistair Buxton 2016-06-27 20:30:52 CEST
*** Bug 11927 has been marked as a duplicate of this bug. ***
Comment 8 Theo Linkspfeifer editbugs 2019-04-25 19:59:49 CEST
Patch tested. Works.
Comment 9 Git Bot editbugs 2019-04-25 22:32:29 CEST
Andre Miranda referenced this bugreport in commit f220dfcc39e122348de89706c0ee2f57bc18c035

Do not core dump on silly errors, just exit (Bug #12413)

https://git.xfce.org/apps/mousepad/commit?id=f220dfcc39e122348de89706c0ee2f57bc18c035
Comment 10 Andre Miranda editbugs 2019-04-25 22:35:15 CEST
There is still one occurrence of g_error in mousepad_prefs_dialog_init, but I think in that case it makes sense to die dramatically.

Bug #12413

Reported by:
Steve
Reported on: 2016-01-19
Last modified on: 2019-04-25

People

Assignee:
Matthew Brush
CC List:
3 users

Version

Target Milestone:
Mousepad 0.2.x

Attachments

gdb session with backtrace (1.75 KB, text/plain)
2016-01-19 23:20 CET , Steve
no flags
Fix patch (927 bytes, patch)
2016-01-20 14:38 CET , Andre Miranda
no flags
Fix patch 2 (1.64 KB, patch)
2016-01-23 16:10 CET , Andre Miranda
no flags

Additional information