Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-fix-file-remote-type-search-crash into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-fix-file-remote-type-search-crash
Merge into: ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic
Prerequisite: ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-xubuntu-cancel-search
Diff against target: 439 lines (+136/-222)
8 files modified
debian/changelog (+4/-5)
debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch (+1/-1)
debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch (+1/-1)
debian/patches/0018-search-engine-add-locate-based-search-engine.patch (+1/-1)
debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch (+1/-1)
debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch (+127/-0)
debian/patches/series (+1/-1)
dev/null (+0/-212)
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+355859@code.launchpad.net

This proposal supersedes a proposal from 2018-09-28.

This proposal has been superseded by a proposal from 2018-10-04.

To post a comment you must log in.
fde29bc... by Marco Trevisan (Treviño)

Finalise changelog

Unmerged commits

fde29bc... by Marco Trevisan (Treviño)

Finalise changelog

43a23ec... by Marco Trevisan (Treviño)

d/p/search-engine-Query-file-system-to-determine-remoteness.patch

Cherry-pick remote filesystem check on file during search.

Fixes LP: #1795028

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 312bb43..1d1673f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,9 @@
1nautilus (1:3.26.4-0~ubuntu18.04.2) UNRELEASED; urgency=medium1nautilus (1:3.26.4-0~ubuntu18.04.2) bionic; urgency=medium
22
3 * d/p/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch:3 * d/p/search-engine-Query-file-system-to-determine-remoteness.patch:
4 shell-search-provider: implement XUbuntuCancel to request pending4 - Fix remote filesystem check on file during search (LP: #1795028)
5 search cancellation from gnome-shell (LP: #1756826)
65
7 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 05 Sep 2018 18:03:14 +02006 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 04 Oct 2018 16:15:08 +0200
87
9nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium8nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium
109
diff --git a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
index f80997f..20e597c 100644
--- a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
+++ b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
@@ -512,7 +512,7 @@ index 0000000..bcd73b9
512+512+
513+#endif /* __NAUTILUS_SEARCH_ENGINE_RECENT_H__ */513+#endif /* __NAUTILUS_SEARCH_ENGINE_RECENT_H__ */
514diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c514diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
515index 3a0c9d4..793b831 100644515index 28863f7..a4c6007 100644
516--- a/src/nautilus-search-engine.c516--- a/src/nautilus-search-engine.c
517+++ b/src/nautilus-search-engine.c517+++ b/src/nautilus-search-engine.c
518@@ -30,11 +30,13 @@518@@ -30,11 +30,13 @@
diff --git a/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch b/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch
index e6185da..ad248da 100644
--- a/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch
+++ b/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch
@@ -49,7 +49,7 @@ index 19316e8..9bb5460 100644
49 49
50 /* Now send out the changed and added signals for existing file objects. */50 /* Now send out the changed and added signals for existing file objects. */
51diff --git a/src/nautilus-file.c b/src/nautilus-file.c51diff --git a/src/nautilus-file.c b/src/nautilus-file.c
52index 63413a6..9416214 10064452index 28b5a13..7886d1f 100644
53--- a/src/nautilus-file.c53--- a/src/nautilus-file.c
54+++ b/src/nautilus-file.c54+++ b/src/nautilus-file.c
55@@ -34,6 +34,7 @@55@@ -34,6 +34,7 @@
diff --git a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
index 91a7ec0..158b448 100644
--- a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
+++ b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch
@@ -678,7 +678,7 @@ index 0000000..ac5e3fc
678+678+
679+#endif /* __NAUTILUS_SEARCH_ENGINE_LOCATE_H__ */679+#endif /* __NAUTILUS_SEARCH_ENGINE_LOCATE_H__ */
680diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c680diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
681index 793b831..902d483 100644681index a4c6007..475a432 100644
682--- a/src/nautilus-search-engine.c682--- a/src/nautilus-search-engine.c
683+++ b/src/nautilus-search-engine.c683+++ b/src/nautilus-search-engine.c
684@@ -29,6 +29,7 @@684@@ -29,6 +29,7 @@
diff --git a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
index fddae3e..3c89693 100644
--- a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
+++ b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch
@@ -198,7 +198,7 @@ index b567611..b165d63 100644
198+198+
199 #endif /* NAUTILUS_FILE_UTILITIES_H */199 #endif /* NAUTILUS_FILE_UTILITIES_H */
200diff --git a/src/nautilus-file.c b/src/nautilus-file.c200diff --git a/src/nautilus-file.c b/src/nautilus-file.c
201index 3f6a69f..63413a6 100644201index 22ea199..e30d791 100644
202--- a/src/nautilus-file.c202--- a/src/nautilus-file.c
203+++ b/src/nautilus-file.c203+++ b/src/nautilus-file.c
204@@ -4975,6 +4975,29 @@ nautilus_file_get_filesystem_type (NautilusFile *file)204@@ -4975,6 +4975,29 @@ nautilus_file_get_filesystem_type (NautilusFile *file)
diff --git a/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch b/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch
205new file mode 100644205new file mode 100644
index 0000000..1b7f874
--- /dev/null
+++ b/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch
@@ -0,0 +1,127 @@
1From: Ernestas Kulik <ernestask@gnome.org>
2Date: Fri, 14 Sep 2018 12:52:11 +0200
3Subject: search-engine: Query file system to determine remoteness
4
5Querying the file cache in is_recursive_search() does not guarantee that
6the file system field will be populated with a value, and somehow
7results in data races, in turn resulting in random crashes/file list
8corruption.
9
10Hopefully fixes https://gitlab.gnome.org/GNOME/nautilus/issues/640,
11closes https://gitlab.gnome.org/GNOME/nautilus/issues/632 and resolves
12https://gitlab.gnome.org/GNOME/nautilus/issues/602
13
14Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1795028
15Applied-Upstream: yes, 3.30.1, https://gitlab.gnome.org/GNOME/nautilus/commit/62ba6d83d
16---
17 src/nautilus-file-utilities.c | 18 ++++++++++++++++++
18 src/nautilus-file-utilities.h | 2 ++
19 src/nautilus-file.c | 14 +-------------
20 src/nautilus-search-engine.c | 18 +++++++++++++++---
21 4 files changed, 36 insertions(+), 16 deletions(-)
22
23diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
24index f8d8476..3e363a4 100644
25--- a/src/nautilus-file-utilities.c
26+++ b/src/nautilus-file-utilities.c
27@@ -1565,3 +1565,21 @@ location_settings_search_get_recursive_for_location (GFile *location)
28
29 return recursive;
30 }
31+
32+gboolean
33+nautilus_file_system_is_remote (const char *file_system)
34+{
35+ static const gchar * const remote_types[] =
36+ {
37+ "afp",
38+ "google-drive",
39+ "sftp",
40+ "webdav",
41+ "ftp",
42+ "nfs",
43+ "cifs",
44+ NULL
45+ };
46+
47+ return file_system != NULL && g_strv_contains (remote_types, file_system);
48+}
49diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h
50index b165d63..37f7f49 100644
51--- a/src/nautilus-file-utilities.h
52+++ b/src/nautilus-file-utilities.h
53@@ -133,4 +133,6 @@ gchar * nautilus_uri_to_native_uri (const gchar *uri);
54 NautilusQueryRecursive location_settings_search_get_recursive (void);
55 NautilusQueryRecursive location_settings_search_get_recursive_for_location (GFile *location);
56
57+gboolean nautilus_file_system_is_remote (const char *file_system);
58+
59 #endif /* NAUTILUS_FILE_UTILITIES_H */
60diff --git a/src/nautilus-file.c b/src/nautilus-file.c
61index e30d791..28b5a13 100644
62--- a/src/nautilus-file.c
63+++ b/src/nautilus-file.c
64@@ -8371,18 +8371,6 @@ nautilus_file_is_in_recent (NautilusFile *file)
65 return nautilus_directory_is_in_recent (file->details->directory);
66 }
67
68-static const gchar * const remote_types[] =
69-{
70- "afp",
71- "google-drive",
72- "sftp",
73- "webdav",
74- "ftp",
75- "nfs",
76- "cifs",
77- NULL
78-};
79-
80 /**
81 * nautilus_file_is_remote
82 *
83@@ -8406,7 +8394,7 @@ nautilus_file_is_remote (NautilusFile *file)
84
85 filesystem_type = nautilus_file_get_filesystem_type (file);
86
87- return filesystem_type != NULL && g_strv_contains (remote_types, filesystem_type);
88+ return nautilus_file_system_is_remote (filesystem_type);
89 }
90
91 /**
92diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
93index 3a0c9d4..28863f7 100644
94--- a/src/nautilus-search-engine.c
95+++ b/src/nautilus-search-engine.c
96@@ -23,7 +23,7 @@
97 #include "nautilus-search-engine.h"
98 #include "nautilus-search-engine-private.h"
99
100-#include "nautilus-file.h"
101+#include "nautilus-file-utilities.h"
102 #include "nautilus-search-engine-model.h"
103 #include "nautilus-search-provider.h"
104 #include <glib/gi18n.h>
105@@ -437,8 +437,20 @@ is_recursive_search (NautilusSearchEngineType engine_type,
106
107 case NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY:
108 {
109- g_autoptr (NautilusFile) file = nautilus_file_get (location);
110- return !nautilus_file_is_remote (file);
111+ g_autoptr (GFileInfo) file_system_info = NULL;
112+
113+ file_system_info = g_file_query_filesystem_info (location,
114+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
115+ NULL, NULL);
116+ if (file_system_info != NULL)
117+ {
118+ const char *file_system;
119+
120+ file_system = g_file_info_get_attribute_string (file_system_info,
121+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
122+
123+ return !nautilus_file_system_is_remote (file_system);
124+ }
125 }
126 }
127
diff --git a/debian/patches/series b/debian/patches/series
index 61d3d3a..2942ff8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,6 +17,7 @@ ubuntu_backspace_behaviour.patch
17#Needs updating17#Needs updating
18#16_unity_new_documents.patch18#16_unity_new_documents.patch
19query-add-recursive-flags-and-use-it-in-search-engines.patch19query-add-recursive-flags-and-use-it-in-search-engines.patch
20search-engine-Query-file-system-to-determine-remoteness.patch
200015-tracker-search-engine-don-t-start-it-if-not-availabl.patch210015-tracker-search-engine-don-t-start-it-if-not-availabl.patch
210016-search-engine-add-a-recent-search-engine-listing-Gtk.patch220016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
220017-recent-add-function-to-update-manager-on-file-rename.patch230017-recent-add-function-to-update-manager-on-file-rename.patch
@@ -24,4 +25,3 @@ query-add-recursive-flags-and-use-it-in-search-engines.patch
24appstream-compulsory.patch25appstream-compulsory.patch
25nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch26nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch
26file-view-Always-unset-pending_selection-after-freeing-it.patch27file-view-Always-unset-pending_selection-after-freeing-it.patch
27ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
diff --git a/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch b/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
28deleted file mode 10064428deleted file mode 100644
index ca55544..0000000
--- a/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch
+++ /dev/null
@@ -1,212 +0,0 @@
1From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
2Date: Tue, 28 Aug 2018 01:44:49 +0200
3Subject: shell-search-provider: implement XUbuntuCancel to request search cancellation
4
5Stop search and Metadata fetching on XUbuntuCancel dbus method call.
6Only allow this if the caller is the same who triggered the actual event.
7
8Bug-GNOME: https://gitlab.gnome.org/GNOME/gnome-shell/issues/183
9Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/nautilus/+bug/1756826
10Forwarded: not-needed
11---
12 data/shell-search-provider-dbus-interfaces.xml | 1 +
13 src/nautilus-shell-search-provider.c | 96 +++++++++++++++++++++++---
14 2 files changed, 88 insertions(+), 9 deletions(-)
15
16diff --git a/data/shell-search-provider-dbus-interfaces.xml b/data/shell-search-provider-dbus-interfaces.xml
17index f6840e2..4529c1e 100644
18--- a/data/shell-search-provider-dbus-interfaces.xml
19+++ b/data/shell-search-provider-dbus-interfaces.xml
20@@ -40,5 +40,6 @@
21 <arg type='as' name='Terms' direction='in' />
22 <arg type='u' name='Timestamp' direction='in' />
23 </method>
24+ <method name = 'XUbuntuCancel' />
25 </interface>
26 </node>
27diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
28index ffc2b7f..58864d6 100644
29--- a/src/nautilus-shell-search-provider.c
30+++ b/src/nautilus-shell-search-provider.c
31@@ -60,6 +60,7 @@ struct _NautilusShellSearchProvider
32
33 PendingSearch *current_search;
34
35+ GList *metas_requests;
36 GHashTable *metas_cache;
37 };
38
39@@ -143,11 +144,25 @@ pending_search_finish (PendingSearch *search,
40 }
41
42 static void
43-cancel_current_search (NautilusShellSearchProvider *self)
44+cancel_current_search (NautilusShellSearchProvider *self,
45+ gboolean ignore_partial_results)
46 {
47- if (self->current_search != NULL)
48+ PendingSearch *search = self->current_search;
49+
50+ if (search != NULL)
51 {
52- nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (self->current_search->engine));
53+ g_debug ("*** Cancel current search");
54+
55+ nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (search->engine));
56+
57+ if (ignore_partial_results)
58+ {
59+ g_signal_handlers_disconnect_by_data (G_OBJECT (search->engine),
60+ search);
61+
62+ pending_search_finish (search, search->invocation,
63+ g_variant_new ("(as)", NULL));
64+ }
65 }
66 }
67
68@@ -451,7 +466,7 @@ execute_search (NautilusShellSearchProvider *self,
69 NautilusQuery *query;
70 PendingSearch *pending_search;
71
72- cancel_current_search (self);
73+ cancel_current_search (self, FALSE);
74
75 /* don't attempt searches for a single character */
76 if (g_strv_length (terms) == 1 &&
77@@ -524,6 +539,7 @@ typedef struct
78 NautilusShellSearchProvider *self;
79
80 gint64 start_time;
81+ NautilusFileListHandle *handle;
82 GDBusMethodInvocation *invocation;
83
84 gchar **uris;
85@@ -532,6 +548,8 @@ typedef struct
86 static void
87 result_metas_data_free (ResultMetasData *data)
88 {
89+ g_clear_pointer (&data->handle, nautilus_file_list_cancel_call_when_ready);
90+
91 g_clear_object (&data->self);
92 g_clear_object (&data->invocation);
93 g_strfreev (data->uris);
94@@ -549,7 +567,7 @@ result_metas_return_from_cache (ResultMetasData *data)
95
96 g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
97
98- for (idx = 0; data->uris[idx] != NULL; idx++)
99+ for (idx = 0; data->uris && data->uris[idx] != NULL; idx++)
100 {
101 meta = g_hash_table_lookup (data->self->metas_cache,
102 data->uris[idx]);
103@@ -564,6 +582,37 @@ result_metas_return_from_cache (ResultMetasData *data)
104 g_variant_new ("(aa{sv})", &builder));
105 }
106
107+static void
108+cancel_result_meta_requests (NautilusShellSearchProvider *self,
109+ GDBusMethodInvocation *invocation)
110+{
111+ GList *l;
112+ GList *to_remove = NULL;
113+
114+ g_debug ("*** Cancel Results Meta requests");
115+
116+ for (l = self->metas_requests; l; l = l->next)
117+ {
118+ ResultMetasData *data = l->data;
119+
120+ if (invocation == NULL ||
121+ g_strcmp0 (g_dbus_method_invocation_get_sender (data->invocation),
122+ g_dbus_method_invocation_get_sender (invocation)) == 0)
123+ {
124+ g_clear_pointer (&data->uris, g_strfreev);
125+ result_metas_return_from_cache (data);
126+ to_remove = g_list_prepend (to_remove, data);
127+ }
128+ }
129+
130+ for (l = to_remove; l; l = l->next)
131+ {
132+ self->metas_requests = g_list_remove (self->metas_requests, l->data);
133+ }
134+
135+ g_list_free (to_remove);
136+}
137+
138 static void
139 result_list_attributes_ready_cb (GList *file_list,
140 gpointer user_data)
141@@ -639,6 +688,9 @@ result_list_attributes_ready_cb (GList *file_list,
142 g_free (uri);
143 }
144
145+ data->handle = NULL;
146+ data->self->metas_requests = g_list_remove (data->self->metas_requests, data);
147+
148 result_metas_return_from_cache (data);
149 result_metas_data_free (data);
150 }
151@@ -682,9 +734,10 @@ handle_get_result_metas (NautilusShellSearchProvider2 *skeleton,
152
153 nautilus_file_list_call_when_ready (missing_files,
154 NAUTILUS_FILE_ATTRIBUTES_FOR_ICON,
155- NULL,
156+ &data->handle,
157 result_list_attributes_ready_cb,
158 data);
159+ self->metas_requests = g_list_prepend (self->metas_requests, data);
160 nautilus_file_list_free (missing_files);
161 return TRUE;
162 }
163@@ -743,14 +796,37 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton,
164 return TRUE;
165 }
166
167-static void
168-search_provider_dispose (GObject *obj)
169+static gboolean
170+handle_xubuntu_cancel (NautilusShellSearchProvider2 *skeleton,
171+ GDBusMethodInvocation *invocation,
172+ gpointer user_data)
173 {
174+ NautilusShellSearchProvider *self = user_data;
175+ PendingSearch *search = self->current_search;
176+
177+ g_debug ("*** XUbuntuCancel called");
178+
179+ if (search != NULL &&
180+ g_strcmp0 (g_dbus_method_invocation_get_sender (search->invocation),
181+ g_dbus_method_invocation_get_sender (invocation)) == 0)
182+ {
183+ cancel_current_search (self, TRUE);
184+ }
185+
186+ cancel_result_meta_requests (self, invocation);
187+
188+ nautilus_shell_search_provider2_complete_xubuntu_cancel (skeleton, invocation);
189+
190+ return TRUE;
191+}
192+
193+ static void search_provider_dispose(GObject * obj) {
194 NautilusShellSearchProvider *self = NAUTILUS_SHELL_SEARCH_PROVIDER (obj);
195
196 g_clear_object (&self->skeleton);
197 g_hash_table_destroy (self->metas_cache);
198- cancel_current_search (self);
199+ cancel_current_search (self, TRUE);
200+ cancel_result_meta_requests (self, NULL);
201
202 G_OBJECT_CLASS (nautilus_shell_search_provider_parent_class)->dispose (obj);
203 }
204@@ -773,6 +849,8 @@ nautilus_shell_search_provider_init (NautilusShellSearchProvider *self)
205 G_CALLBACK (handle_activate_result), self);
206 g_signal_connect (self->skeleton, "handle-launch-search",
207 G_CALLBACK (handle_launch_search), self);
208+ g_signal_connect (self->skeleton, "handle-xubuntu-cancel",
209+ G_CALLBACK (handle_xubuntu_cancel), self);
210 }
211
212 static void

Subscribers

People subscribed via source and target branches