After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745454 - Segmentation fault after find files.
Segmentation fault after find files.
Status: RESOLVED FIXED
Product: gnome-commander
Classification: Other
Component: application
1.4.x
Other Linux
: High critical
: 1.4
Assigned To: GNOME Commander maintainer(s)
GNOME Commander maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-02 13:17 UTC by Pavel Elagin
Modified: 2015-05-25 19:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdb log on gcmd 1.4.6 (40.06 KB, text/plain)
2015-05-20 06:52 UTC, Mamoru TASAKA
  Details
Proposal patch (3.53 KB, patch)
2015-05-21 05:37 UTC, Mamoru TASAKA
none Details | Review

Description Pavel Elagin 2015-03-02 13:17:14 UTC
1. Press F9.
2. Press "Enter"
3. Get "Segmentation fault."

Run gnome-commander under gdb and get:

Program received signal SIGSEGV, Segmentation fault.
GnomeCmdFileList::key_pressed (this=0x9e6570, event=event@entry=0xc7d600) at gnome-cmd-file-list.cc:2388
2388	                return mime_exec_file (get_focused_file());

I think that this is due to the fact that not more than one selected file found, the button "Go To" is not active, but when you press the "Enter" does not check for file selection, so get_focused_file return null.
Comment 1 André Klapper 2015-03-02 14:35:21 UTC
Thanks for taking the time to report this.

Could you provide a full stracktrace?
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces for more information on how to do so. When pasting a stack trace in this bug report, please reset the status of this bug report from NEEDINFO to its previous status. Thanks in advance!
Comment 2 Pavel Elagin 2015-03-02 14:54:24 UTC
Program received signal SIGSEGV, Segmentation fault.
GnomeCmdFileList::key_pressed (this=0x9e6570, event=event@entry=0xc44eb0) at gnome-cmd-file-list.cc:2388
2388	                return mime_exec_file (get_focused_file());
(gdb) bt
  • #0 GnomeCmdFileList::key_pressed
    at gnome-cmd-file-list.cc line 2388
  • #1 GnomeCmdSearchDialog::Private::on_list_keypressed
    at gnome-cmd-search-dialog.cc line 839
  • #2 ??
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #3 g_closure_invoke
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #4 ??
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #5 g_signal_emit_valist
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #6 g_signal_emit
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #7 ??
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #8 gtk_window_propagate_key_event
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #9 ??
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #10 ??
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #11 g_closure_invoke
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #12 ??
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #13 g_signal_emit_valist
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #14 g_signal_emit
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #15 ??
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #16 gtk_propagate_event
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #17 gtk_main_do_event
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #18 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
  • #19 g_main_context_dispatch
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #20 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #21 g_main_loop_run
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #22 gtk_main
    from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
  • #23 main
    at main.cc line 179

Comment 3 Pavel Elagin 2015-03-03 12:25:33 UTC
I want to offer the option:

inline gboolean mime_exec_file (GnomeCmdFile *f)
{
	if (f != NULL && f->info->type == GNOME_VFS_FILE_TYPE_REGULAR)
	{
		mime_exec_single (f);
		return TRUE;
	}

	return FALSE;
}
Comment 4 Uwe Scholz 2015-03-03 21:15:59 UTC
Hi Pavel,

thank you very much for your bug report and the stack trace you provided. Unfortunately I can not reproduce the crash you described by steps 1-3 above with the current development version. Can you tell what exact GCMD-version you are using?

Thanks in advance, 
Uwe
Comment 5 Pavel Elagin 2015-03-04 09:37:33 UTC
GNOME gnome-commander 1.4.6

From git clone -b gcmd-1-4 git://git.gnome.org/gnome-commander and git clone git://git.gnome.org/gnome-commander

After find files immediately press key "enter" without selecting any file in the list.
Comment 6 Uwe Scholz 2015-03-06 09:09:14 UTC
(In reply to Pavel Elagin from comment #5)
> After find files immediately press key "enter" without selecting any file in
> the list.

Meanwhile I could reproduce this behavior, too. In my case GCMD crashes only, when the list of found files is empty and I press enter immediately after the search.

Thank you for your offered solution in comment #3.  I will have a look into it, as soon as possible.
Comment 7 Uwe Scholz 2015-03-06 23:29:44 UTC
More Info: I tested your code. Unfortunately, GCMD still crashes. But I have to admit that I trigger the crash slightly differently:

1. Press F9
2. Press "Enter" -> No crash!
3. Only when nothing is found: -> Pressing "Enter" again leads to the crash

My backtrace seems to be totally broken in this case, which is a hint to some hidden memory leaks.

Your code comment above is a reasonable modification of mime_exec_file. I applied it to the master branch in a modified form. Can you verify that the crash does not occur in your case then pulling the master branch?
Comment 8 Uwe Scholz 2015-05-09 21:15:47 UTC

*** This bug has been marked as a duplicate of bug 748869 ***
Comment 9 Mamoru TASAKA 2015-05-20 06:52:38 UTC
Created attachment 303636 [details]
gdb log on gcmd 1.4.6

Hello.

I've met this bug with gcmd 1.4.6 and somehow managed to find how to
reproduce this.

With gcmd 1.4.6:
* Select "File"->"Search"
* On "Search..." dialog, 
  - write "*.pdf" on the right text box of "Path matches regex:"
  - choose "Current directory only"
* Click "Find", returning "Found 10 matches", for example.
* Destroy "Search..." dialog with cross (x) button (at the top-right of the window)
* Again Select "File"->"Search"
* Just type Enter key

Then gcmd 1.4.6 crashes with the attached gdb log.
Backporting 5b0b3a469ab426feb596b0edfcc61cde4c0e6e80 fixes this issue. 
Would you backport the above commit to gcmd-1-4 branch?
Comment 10 Uwe Scholz 2015-05-20 20:10:10 UTC
Hi,

commit 5b0b3a4 was only committed in the master branch, not in gcmd-1-4 branch. I committed this change only in master as the crash of gcmd is not fixed with this commit. 

But now, when looking again on 5b0b3a4, I think that I made a slight mistake there, which has to be fixed. Now, it should be:

diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index d46ed16..8f689a2 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1177,9 +1177,10 @@ inline gboolean mime_exec_file (GnomeCmdFile *f)
     if (f->info->type == GNOME_VFS_FILE_TYPE_REGULAR)
     {
         mime_exec_single (f);
+        return TRUE;
     }
+    return FALSE;
 
-    return TRUE;
  }

What do you think?

Nevertheless, I think you are right and the bug has nothing to do with mime_exec_file(). I guess, there is again a problem with memory allocation.
Comment 11 Mamoru TASAKA 2015-05-21 05:37:59 UTC
Created attachment 303725 [details] [review]
Proposal patch

So the problem seem to be that sometimes GnomeCmdSearchDialog priv->result_list receives "key-press-event" because focus is not set explicitly.
I wrote a proposal patch to set focus explicitly when doing search.

(Anyway modifying mime_exec_file() should be no problem)
Comment 12 Mamoru TASAKA 2015-05-21 05:39:04 UTC
The above patch is for gcmd-1-4 branch.
Comment 13 Uwe Scholz 2015-05-25 19:01:07 UTC
And again a clean patch from Mamoru. Thank you very much. I checked it and it does its job very well! The fix will go into the next bugfix release of gcmd.