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 123051 - dragging folders into a different folder caused a crash
dragging folders into a different folder caused a crash
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: [obsolete] Sidebar Panel: Tree
2.10.x
Other All
: High critical
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 125073 125402 129037 133657 134374 134375 145677 146049 156486 160430 167157 169096 169351 170156 171705 301611 302675 302775 303817 304780 305239 305571 306255 307263 307453 307462 308147 310943 316718 317595 318812 380937 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-09-23 18:44 UTC by George Karabin
Modified: 2006-11-30 18:30 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
backtrace, such as it is... (10.73 KB, text/plain)
2003-09-23 18:45 UTC, George Karabin
  Details
Fixes the gqsort.c:g_qsort_with_data, where it sorts the folder (811 bytes, patch)
2003-11-07 05:44 UTC, Srinivasa Ragavan
needs-work Details | Review
test case for patch (495 bytes, text/plain)
2005-05-21 14:40 UTC, George Karabin
  Details
fix for dummy row sorting (654 bytes, patch)
2005-08-31 15:13 UTC, Alexander Larsson
committed Details | Review

Description George Karabin 2003-09-23 18:44:43 UTC
In the icon view, I dragged three folders in my home directory (names
doen't seem to matter)  named a,b, and c into a third folder named d. The
drag completes successfully, but if the next action I perform is to
double-click on d to open it, nautilus will crash.

This seems to be 100% reproducible if I drag 3 or more folders into
another. I don't see it if I drag only 1 or 2.
Comment 1 George Karabin 2003-09-23 18:45:56 UTC
Created attachment 20217 [details]
backtrace, such as it is...
Comment 2 mwehner 2003-09-27 19:19:48 UTC
I'm seeing a very similar crash on my system pretty often - but I
can't reproduce it reliably. It always involves moving stuff around
and then changing the selection in the sidebar tree.
The instructions given here don't reproduce it for me unfortunately.

Setting Priority->High, Severity->critical, adding STACKTRACE &
GNOMEVER2.5 keywords. Setting Component to Sidebar Panel:Tree.
Comment 3 mwehner 2003-09-27 19:22:15 UTC
Reposting original stack trace inline to make searching easier.

Backtrace was generated from '/usr/bin/nautilus'

(no debugging symbols found)...Using host libthread_db library
"/lib/tls/libthread_db.so.1".
(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...[Thread
debugging using libthread_db enabled]
[New Thread -1085185920 (LWP 6655)]
[New Thread 12585904 (LWP 6660)]
[New Thread 11983792 (LWP 6659)]
[New Thread 11410352 (LWP 6658)]
[New Thread 8403888 (LWP 6657)]
[New Thread 15244208 (LWP 6656)]

(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
0x00185c02 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2

Thread 1 (Thread -1085185920 (LWP 6655))

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 __waitpid_nocancel
    from /lib/tls/libpthread.so.0
  • #2 libgnomeui_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #3 <signal handler called>
  • #4 gtk_tree_model_sort_new_with_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #5 g_qsort_with_data
    from /usr/lib/libglib-2.0.so.0
  • #6 g_array_sort_with_data
    from /usr/lib/libglib-2.0.so.0
  • #7 gtk_tree_model_sort_new_with_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #8 gtk_tree_model_sort_convert_iter_to_child_iter
    from /usr/lib/libgtk-x11-2.0.so.0
  • #9 gtk_tree_model_sort_get_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #10 gtk_tree_model_sort_convert_child_path_to_path
    from /usr/lib/libgtk-x11-2.0.so.0
  • #11 nautilus_tree_view_get_type
    from /usr/lib/bonobo/libnautilus-tree-view.so
  • #12 g_timeout_add
    from /usr/lib/libglib-2.0.so.0
  • #13 unblock_source
    from /usr/lib/libglib-2.0.so.0
  • #14 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #15 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #16 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #17 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #18 ??
  • #19 ??
  • #20 ??
  • #21 ??
  • #22 ??
  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2

Comment 4 mwehner 2003-09-27 19:23:15 UTC
This is one of my stack traces:

Backtrace was generated from '/usr/bin/nautilus'

[New Thread 1089429376 (LWP 4540)]
[New Thread 1102310320 (LWP 5361)]
[New Thread 1102044080 (LWP 5360)]
[New Thread 1101777840 (LWP 5359)]
[New Thread 1101478832 (LWP 5290)]
[New Thread 1095056304 (LWP 4548)]
[New Thread 1093872560 (LWP 4545)]
[New Thread 1093606320 (LWP 4544)]
[New Thread 1093340080 (LWP 4543)]
[New Thread 1093073840 (LWP 4542)]
[New Thread 1092807600 (LWP 4541)]
0xffffe410 in ?? ()

Thread 1 (Thread 1089429376 (LWP 4540))

  • #0 ??
  • #1 <signal handler called>
  • #2 gtk_tree_model_sort_new_with_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #3 g_qsort_with_data
    from /usr/lib/libglib-2.0.so.0
  • #4 g_array_sort_with_data
    from /usr/lib/libglib-2.0.so.0
  • #5 gtk_tree_model_sort_new_with_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #6 gtk_tree_model_sort_convert_iter_to_child_iter
    from /usr/lib/libgtk-x11-2.0.so.0
  • #7 gtk_tree_model_sort_get_model
    from /usr/lib/libgtk-x11-2.0.so.0
  • #8 gtk_tree_model_sort_convert_child_path_to_path
    from /usr/lib/libgtk-x11-2.0.so.0
  • #9 show_selection_idle_callback
    at nautilus-tree-view.c line 167
  • #10 g_timeout_add
    from /usr/lib/libglib-2.0.so.0
  • #11 unblock_source
    from /usr/lib/libglib-2.0.so.0
  • #12 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #13 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #14 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #15 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #16 main
    at nautilus-main.c line 282
  • #17 __libc_start_main
    from /lib/tls/libc.so.6
  • #0 ??

Comment 5 Martin Wehner 2003-10-21 13:26:24 UTC
*** Bug 125073 has been marked as a duplicate of this bug. ***
Comment 6 Srinivasa Ragavan 2003-11-07 05:42:49 UTC
I have fixed the crash, and attaching a patch.
I am not very sure that , this is 'THE' fix. It could also be a
workaround.

There was a problem with the sorting, when the folder is opened. It
dumps in the comparision function 'gtk_tree_model_sort_compare_func()'
When i debugged, in the gqsort.c g_qsort_with_data, it went behind the
base pointer and passes the function some junk data. I put a filter
constraint, to make sure that it is between base_ptr and (base_ptr+size).

It fixed the problem and worked. It is a patch in glib/glib/gqsort.c

If the patch is wrong, you can proceed from the point ,
gtktreemodelsort.c:gtk_tree_model_sort_sort_level (), from where all
the sorting operations are carried forward. 
Comment 7 Srinivasa Ragavan 2003-11-07 05:44:58 UTC
Created attachment 21264 [details] [review]
Fixes the gqsort.c:g_qsort_with_data, where it sorts the folder
Comment 8 Elijah Newren 2003-12-11 00:33:04 UTC
*** Bug 129037 has been marked as a duplicate of this bug. ***
Comment 9 George Karabin 2004-01-14 16:45:27 UTC
Srinivasa, can you still duplicate the bug? I can't. I took a look at
your patch. If the rest of the quicksort algorithm is implemented
properly, and if the scan through the first threshold for the lowest
value is correct, then the only way I can see the problem occuring is
if compare_func has been implemented in such as way as to return
different values for the same comparison done at different times. That
seems to be the only way that a comparison between base_ptr[0] and
base_ptr[1] can cause tmp_ptr to underflow in the insertion sort -
basically, base_ptr[0] has to end up holding a value that isn't the
lowest value in the array. I would think this would be a problem in
the tree view, or perhaps its creator.

I can't duplicate this using the method that I described any more, now
that I've tried again with Fedora Core 1 (plus updates). I'd close the
bug, were it not that Bug #129037 was apparently filed with FC1 as
well. From the changelog on the gtk2 RPM I've got, it doesn't seem
like much would have changed since I filed the report (probably was
using gtk 2.2.4-3.0 (fedora rev) at that point.
Comment 10 Dave Camp 2004-01-22 20:18:04 UTC
the glib change doesn't fix the root cause, removing PATCH.
Comment 11 Martin Wehner 2004-01-25 16:40:02 UTC
*** Bug 125402 has been marked as a duplicate of this bug. ***
Comment 12 Martin Wehner 2004-02-06 21:53:23 UTC
*** Bug 133657 has been marked as a duplicate of this bug. ***
Comment 13 Theodore Randall 2004-02-16 03:48:56 UTC
*** Bug 134375 has been marked as a duplicate of this bug. ***
Comment 14 Theodore Randall 2004-02-16 03:51:54 UTC
*** Bug 134374 has been marked as a duplicate of this bug. ***
Comment 15 Martin Wehner 2004-07-10 16:58:14 UTC
*** Bug 145677 has been marked as a duplicate of this bug. ***
Comment 16 Martin Wehner 2004-07-10 17:00:37 UTC
*** Bug 146049 has been marked as a duplicate of this bug. ***
Comment 17 Martin Wehner 2004-09-16 19:31:42 UTC
No dups with Nautilus > 2.4, marking NEEDINFO for now.
Comment 18 Vincent Noel 2004-10-27 14:54:19 UTC
*** Bug 156486 has been marked as a duplicate of this bug. ***
Comment 19 Matthew Gatto 2004-11-04 04:59:14 UTC
bug 156486 occured on GNOME-2.6, so bumping Version => 2.6.
Comment 20 Sebastien Bacher 2005-02-13 11:57:22 UTC
no dups since GNOME 2.6, bug closed.
Comment 21 Martin Wehner 2005-03-13 13:09:29 UTC
*** Bug 170156 has been marked as a duplicate of this bug. ***
Comment 22 Martin Wehner 2005-03-13 13:10:03 UTC
*** Bug 169096 has been marked as a duplicate of this bug. ***
Comment 23 Martin Wehner 2005-03-13 13:11:15 UTC
Dups with 2.8/2.9 -> reopening & adjusting versions.
Comment 24 Martin Wehner 2005-04-03 18:49:56 UTC
*** Bug 160430 has been marked as a duplicate of this bug. ***
Comment 25 Kjartan Maraas 2005-05-02 09:23:21 UTC
*** Bug 302675 has been marked as a duplicate of this bug. ***
Comment 26 Martin Wehner 2005-05-03 19:24:09 UTC
*** Bug 301611 has been marked as a duplicate of this bug. ***
Comment 27 Martin Wehner 2005-05-03 19:26:06 UTC
*** Bug 302775 has been marked as a duplicate of this bug. ***
Comment 28 Baptiste Mille-Mathias 2005-05-11 19:57:36 UTC
*** Bug 303817 has been marked as a duplicate of this bug. ***
Comment 29 Martin Wehner 2005-05-14 15:19:22 UTC
*** Bug 167157 has been marked as a duplicate of this bug. ***
Comment 30 Elijah Newren 2005-05-20 01:36:13 UTC
*** Bug 304780 has been marked as a duplicate of this bug. ***
Comment 31 Christian Neumair 2005-05-20 08:36:17 UTC
George: It would be great if you could take a look at gqsort.c again. This
problems seems to be very widespread, even in recent versions.
Comment 32 George Karabin 2005-05-21 14:40:31 UTC
Created attachment 46714 [details]
test case for patch

OK, now that I look at it, in any case, g_qsort_with_data must not dereference
pointers outside the bounds of the input array passed in by the caller.  Since
it's doing that in this case, there's got to be a bug in both the caller for
specifying a compare function that isn't really sorting the array. 

So I think the patch or some variant of it should be applied, although there's
got to be a bug elsewhere in the compare function, which I haven't tried to
hunt down. I'm not sure that the patch should just silently ignore the problem.
Asserting an error (which still causes termination) or at least issues a
warning might be better choices. There's no hint in the definition of qsort to
use for error handling.

I've attached a test case to show how a broken compare function (one that
always returns the same result regardless of the input) can cause this sort
function to attempt to dereference out of bounds memory.
Comment 33 George Karabin 2005-05-21 15:03:19 UTC
Amend the end of the first paragraph in to "Since it's doing that in this case, there's got to be a bug in 
both g_qsort_with_data and in the caller (for specifying a compare function that isn't really sorting the 
array)."
Comment 34 Martin Wehner 2005-05-21 17:20:08 UTC
*** Bug 169351 has been marked as a duplicate of this bug. ***
Comment 35 Sebastien Bacher 2005-05-24 08:39:20 UTC
*** Bug 305239 has been marked as a duplicate of this bug. ***
Comment 36 Sebastien Bacher 2005-05-28 12:57:20 UTC
*** Bug 305571 has been marked as a duplicate of this bug. ***
Comment 37 Jhon Honce 2005-06-02 04:57:15 UTC
I use nautilus to sort images.  Moving 800+ source images from one directory
into 4-5 directories. Move to trash is also performed.  Nautilus crashes after
working with 200-300 images.  Restarting the X server appears to cause nautilus
to live longer after a crash then just restarting the application.
Comment 38 Sebastien Bacher 2005-06-02 19:12:32 UTC
*** Bug 306255 has been marked as a duplicate of this bug. ***
Comment 39 Sebastien Bacher 2005-06-11 23:14:20 UTC
*** Bug 307263 has been marked as a duplicate of this bug. ***
Comment 40 Christian Kirbach 2005-06-13 09:07:38 UTC
*** Bug 307453 has been marked as a duplicate of this bug. ***
Comment 41 Christian Kirbach 2005-06-13 09:07:46 UTC
*** Bug 307462 has been marked as a duplicate of this bug. ***
Comment 42 Martin Wehner 2005-06-18 11:38:04 UTC
*** Bug 308147 has been marked as a duplicate of this bug. ***
Comment 43 Christian Kirbach 2005-07-14 21:27:19 UTC
*** Bug 171705 has been marked as a duplicate of this bug. ***
Comment 44 Teppo Turtiainen 2005-07-20 06:03:22 UTC
*** Bug 310943 has been marked as a duplicate of this bug. ***
Comment 45 Alexander Larsson 2005-08-31 15:12:29 UTC
There is a possible cause for this in fm-tree-view.c:compare_rows(). It doesn't
seem to correctly sort the dummy row. compare(dummy, *) and compare(*, dummy)
both return -1.

I'm attaching a patch that fixes this.

However, I'm not sure this is the real problem, because this should only affect
things when the dummy row is sorted against real files, and we remove the dummy
row whenever we add another row.
Comment 46 Alexander Larsson 2005-08-31 15:13:37 UTC
Created attachment 51612 [details] [review]
fix for dummy row sorting
Comment 47 Christian Neumair 2005-09-30 12:48:01 UTC
*** Bug 317595 has been marked as a duplicate of this bug. ***
Comment 48 Christian Neumair 2005-09-30 12:48:38 UTC
*** Bug 316718 has been marked as a duplicate of this bug. ***
Comment 49 Alexander Larsson 2005-09-30 12:56:16 UTC
I commited the last patch. It might work, we'll have to see if duplicates stop
comming in after:

2005-09-30  Alexander Larsson  <alexl@redhat.com>

	* src/file-manager/fm-tree-view.c: (compare_rows):
	Correct sort order for dummy row.
	Possible fix for #123051
Comment 50 oll 2005-09-30 13:09:09 UTC
This is rather magical for a non developper like me :
just changing -1 to 1 !! :-)

Does it mean this should work for nautilus 2.10 too ?
Comment 51 Christian Neumair 2005-09-30 17:25:13 UTC
oll: We ceased to support Nautilus 2.10 when we released 2.12. However, you can
ask your distributor to use this patch for GNOME 2.10. Only time will tell
whether it helps, though.
Comment 52 oll 2005-10-01 10:00:55 UTC
Yes, that's precisely why I asked this question . I installed garnome 2.10.2 for
all my users and I used to apply patches (In one way, I'm my own distributor :-)
). I just wanted to know If this patch is "backportable" to 2.10.
Comment 53 Christian Neumair 2005-10-01 12:37:51 UTC
Yes, it is definitly applicable. While this change seemed to be trivial it
actually fixed a bad sort compare function. Search algorithms often rely on the
assumption that their compare function returns the a value with a swapped sign
[1] for swapped input data, i.e. a > b <=> b < a, in this case

 compare_rows (a, b) == compare_rows (b,a)

[1] http://en.wikipedia.org/wiki/Trichotomy
Comment 54 Christian Neumair 2005-10-14 08:38:26 UTC
*** Bug 318812 has been marked as a duplicate of this bug. ***
Comment 55 Martin Wehner 2006-02-28 22:15:56 UTC
*** Bug 160430 has been marked as a duplicate of this bug. ***
Comment 56 Martin Wehner 2006-04-06 19:34:11 UTC
This is almost certainly fixed by now - If it isn't, we'll find out soon enough.
I think it was related to bug 158506.
Comment 57 Germán Poo-Caamaño 2006-11-30 18:30:32 UTC
*** Bug 380937 has been marked as a duplicate of this bug. ***