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 679099 - "Automatic" GNOME Shell Extension updates
"Automatic" GNOME Shell Extension updates
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-29 05:54 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-07-10 18:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
shellDBus: Split extensions API out into a separate DBus interface (5.93 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Fix loading of downloaded extensions (1.09 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
browser-plugin: Prevent a copy when checking for valid extension UUIDs (3.97 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
browser-plugin: Rework scriptable method argument parsing and dispatch (14.22 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Fix errors during error paths during installation (1.69 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Properly error out when downloading/parsing infos (2.96 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
shellDBus: Add a real error reporting system to InstallExtensionRemote (10.90 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionSystem: Be saner at error handling (7.49 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Clean up names of methods (2.17 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionUtils: Don't crash on startup for an empty directory (1.22 KB, patch)
2012-06-29 05:54 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
extensionDownloader: Add update/blacklist support for extensions (11.52 KB, patch)
2012-06-29 05:55 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
extensionUtils: Don't crash on startup for an empty directory (1.22 KB, patch)
2012-07-07 01:33 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Move extension loading code to the install dialog (3.19 KB, patch)
2012-07-07 01:33 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
extensionDownloader: Add update/blacklist support for extensions (8.76 KB, patch)
2012-07-07 01:33 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:29 UTC
Here's the giant patch stack. So, "automatic" right now means a DBus
interface. I still have to work out the ChangeLog interface so users
know what changed between versions, and I'm hoping to integrate that
with the new "System Updates" stuff that hughsie is hacking on. When
that lands, the flow will be changed to integrate with that; else, I
will add a notification that pops up when extensions can be updated;
pinging the site every 7 days or so on a cron job.

I'm not entirely happy with a lot of the patches in here, especially
with the callback/errback stuff in the error reporting system patch.
I don't want to tie myself to a GDBus invocation, and since it's all
async, I can't use regular exceptions. Maybe it's just time to add a
Promise/Deferred system based on JS generators, like the perf stuff.

I'd like to get any and all input on all of this, especially if it's
by extension authors, shell developers, or John Stowers.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:31 UTC
Created attachment 217575 [details] [review]
shellDBus: Split extensions API out into a separate DBus interface

The generic "Shell" interface was getting a bit too crowded.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:34 UTC
Created attachment 217576 [details] [review]
extensionDownloader: Fix loading of downloaded extensions

We refactored the ExtensionSystem API to take an extension object,
but forgot to update the downloader.
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:37 UTC
Created attachment 217577 [details] [review]
browser-plugin: Prevent a copy when checking for valid extension UUIDs

Instead of using g_strndup to copy the NPString that gets passed to us
by the plugin host, just use the equally-as-good NPString directly. We
still need to copy the string when passing it over DBus, as there's no
easy way to construct a string GVariant from a length-prefixed string.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:40 UTC
Created attachment 217578 [details] [review]
browser-plugin: Rework scriptable method argument parsing and dispatch

Since we're going to move to a much more complicated (async!) solution
in a little bit, we're going to require a lot more machinery to handle
that. To help with that, let's rework invocation dispatch so that it's
more generic. Introduce a parse_args system similar to gjs_parse_args,
use X Macros to help with the repetitive parts of the method dispatch.
This shouldn't cause any API breaks, so API_VERSION should still be 4.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:42 UTC
Created attachment 217579 [details] [review]
extensionDownloader: Fix errors during error paths during installation
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:45 UTC
Created attachment 217580 [details] [review]
extensionDownloader: Properly error out when downloading/parsing infos

When the extension downloader was originally designed, the information
downloading part was inserted at the last minute, along with the modal
dialog as a security feature to make sure an extension didn't silently
get installed on the user's machines either due to a security issue in
the browser-plugin, or an XSS issue on the extensions website. Correct
the mistake I made when writing the code; instead of dropping an error
on the floor, log it correctly. This "bug" has already bitten a number
of users who forgot to configure proxy settings in the control center.
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:48 UTC
Created attachment 217581 [details] [review]
shellDBus: Add a real error reporting system to InstallExtensionRemote

Instead of using the 'extension-state-changed' signal to relay errors,
use DBus's native error mechanism to inform the method caller that the
call has failed. This requires making the method actually asynchronous
so that we don't block the browser, which is stuck waiting for a reply
from the browser plugin. To ensure this, we need to modify the browser
plugin API to ensure its extesion installation method is asynchronous.

Additionally, this lets us remove the awful, broken hacks that we used
when a user clicked the "Cancel" button, replacing it by a DBus return
value.
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:52 UTC
Created attachment 217582 [details] [review]
extensionSystem: Be saner at error handling

Use our native JS error system in the "extension system" API, only
using the signal/log-based error reporting at the last mile. Additionally,
delete the directory if loading the extension failed, and report the error
back over DBus.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:55 UTC
Created attachment 217583 [details] [review]
extensionDownloader: Clean up names of methods

FromUUID is redundant.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:54:58 UTC
Created attachment 217584 [details] [review]
extensionUtils: Don't crash on startup for an empty directory
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-06-29 05:55:00 UTC
Created attachment 217585 [details] [review]
extensionDownloader: Add update/blacklist support for extensions

This is a bare-bones copy/replace. It does not implement ChangeLog
support. If we cannot get System Updates integration, I will implement
notification support.
Comment 12 Giovanni Campagna 2012-07-02 17:46:28 UTC
Review of attachment 217575 [details] [review]:

LGTM
Comment 13 Giovanni Campagna 2012-07-02 17:49:00 UTC
Review of attachment 217576 [details] [review]:

.
Comment 14 Giovanni Campagna 2012-07-02 17:51:11 UTC
Review of attachment 217577 [details] [review]:

I don't think it makes much difference, but ok.
Comment 15 Giovanni Campagna 2012-07-02 17:58:31 UTC
Review of attachment 217578 [details] [review]:

Nice cleanup in general.

::: browser-plugin/browser-plugin.c
@@ +791,3 @@
+#undef METHOD
+
+static NPIdentifier list_extensions_id;

While the double definition?
And why no meta-code for properties and event handlers?
Comment 16 Giovanni Campagna 2012-07-02 17:59:44 UTC
Review of attachment 217579 [details] [review]:

Clearly so.
Comment 17 Giovanni Campagna 2012-07-02 18:01:30 UTC
Review of attachment 217580 [details] [review]:

.
Comment 18 Giovanni Campagna 2012-07-02 18:08:11 UTC
Review of attachment 217581 [details] [review]:

Makes a lot of sense.
Comment 19 Giovanni Campagna 2012-07-02 18:11:04 UTC
Review of attachment 217582 [details] [review]:

Generally ok.

::: js/ui/extensionSystem.js
@@ +116,3 @@
 }
 
+function logExtensionError(uuid, error, state) {

Unused parameter state?
Comment 20 Giovanni Campagna 2012-07-02 18:11:43 UTC
Review of attachment 217583 [details] [review]:

Ok
Comment 21 Giovanni Campagna 2012-07-02 18:16:30 UTC
Review of attachment 217584 [details] [review]:

This is kind of the opposite of the previous error handling patch. Should ExtensionFinder take an error callback instead? This way, it would logged in the usual place for extension errors, and thus reported to e.g.o owners.

Also, using logError makes it look like a Shell error, while it is really an extension error.
Comment 22 Giovanni Campagna 2012-07-02 18:31:16 UTC
Review of attachment 217585 [details] [review]:

::: js/misc/fileUtils.js
@@ +47,3 @@
+}
+
+function recursivelyMoveDir(srcDir, destDir) {

Why this is needed? Docs for g_file_move say that it automatically fallbacks to copy + delete in case rename() fails.

::: js/ui/extensionDownloader.js
@@ +249,3 @@
+                errback('LoadExtensionError', e);
+                return;
+            }

This belongs to an earlier patch.

::: src/shell-util.c
@@ +854,3 @@
+ * A wrapper around g_mkdtemp() that actually works from
+ * introspection, by duplicating the input string. While
+ * we're at it, return a #GFile instead of a path string.

You should fix g_mkdtemp instead of adding this.
(It's just a matter of adding (transfer full) to both the parameter and the return value)
Comment 23 Jasper St. Pierre (not reading bugmail) 2012-07-02 18:40:16 UTC
(In reply to comment #22)
> Review of attachment 217585 [details] [review]:
> 
> Why this is needed? Docs for g_file_move say that it automatically fallbacks to
> copy + delete in case rename() fails.

http://git.gnome.org/browse/glib/tree/gio/gfile.c#n2452

It will intentionally fail, saying it can't recurse. Maybe we should add the feature to Gio. I'll poke someone.

> You should fix g_mkdtemp instead of adding this.
> (It's just a matter of adding (transfer full) to both the parameter and the
> return value)

That's not true at all. Try it.
Comment 24 Giovanni Campagna 2012-07-02 18:54:00 UTC
(In reply to comment #23)
> (In reply to comment #22)
> > Review of attachment 217585 [details] [review] [details]:
> > 
> > Why this is needed? Docs for g_file_move say that it automatically fallbacks to
> > copy + delete in case rename() fails.
> 
> http://git.gnome.org/browse/glib/tree/gio/gfile.c#n2452
> 
> It will intentionally fail, saying it can't recurse. Maybe we should add the
> feature to Gio. I'll poke someone.

I'd say this belongs in Gio, yes. My primary concern anyway was to do atomic renames whenever possible (that is, when /tmp and /home live on the same partition)

> > You should fix g_mkdtemp instead of adding this.
> > (It's just a matter of adding (transfer full) to both the parameter and the
> > return value)
> 
> That's not true at all. Try it.

Tried, and it works... Tried even valgrinding, no errors.
Comment 25 Jasper St. Pierre (not reading bugmail) 2012-07-02 20:12:24 UTC
(In reply to comment #19)
> Review of attachment 217582 [details] [review]:
> 
> Generally ok.

Did you mean to mark this ACN, then?
Comment 26 Giovanni Campagna 2012-07-02 20:14:08 UTC
(In reply to comment #25)
> (In reply to comment #19)
> > Review of attachment 217582 [details] [review] [details]:
> > 
> > Generally ok.
> 
> Did you mean to mark this ACN, then?

Yes, but with the comment addressed.
Comment 27 Giovanni Campagna 2012-07-02 20:15:01 UTC
(In reply to comment #26)
> (In reply to comment #25)
> > (In reply to comment #19)
> > > Review of attachment 217582 [details] [review] [details] [details]:
> > > 
> > > Generally ok.
> > 
> > Did you mean to mark this ACN, then?
> 
> Yes, but with the comment addressed.

Probably I clicked rejected instead of reviewed...
Comment 28 Jasper St. Pierre (not reading bugmail) 2012-07-02 20:20:43 UTC
(In reply to comment #22)
> ::: js/ui/extensionDownloader.js
> @@ +249,3 @@
> +                errback('LoadExtensionError', e);
> +                return;
> +            }
> 
> This belongs to an earlier patch.

I don't understand. Do you want me to split this section out in an earlier patch?

(In reply to comment #21)
> Review of attachment 217584 [details] [review]:
> 
> This is kind of the opposite of the previous error handling patch. Should
> ExtensionFinder take an error callback instead? This way, it would logged in
> the usual place for extension errors, and thus reported to e.g.o owners.

"Meh". We need a much better system for handling async errors. I'm really not the biggest fan of the errback/callback stuff I've already been doing.
Comment 29 Jasper St. Pierre (not reading bugmail) 2012-07-02 21:24:06 UTC
(In reply to comment #24)
> I'd say this belongs in Gio, yes. My primary concern anyway was to do atomic
> renames whenever possible (that is, when /tmp and /home live on the same
> partition)

Not going to happen.
Comment 30 Jasper St. Pierre (not reading bugmail) 2012-07-02 21:46:08 UTC
(In reply to comment #24)
> > That's not true at all. Try it.
> 
> Tried, and it works... Tried even valgrinding, no errors.

Hm. It does work, but this seems like it's exploiting an implementation detail in gjs itself -- it still breaks with PyGObject.
Comment 31 Jasper St. Pierre (not reading bugmail) 2012-07-02 22:30:40 UTC
Attachment 217575 [details] pushed as 7da0f39 - shellDBus: Split extensions API out into a separate DBus interface
Attachment 217576 [details] pushed as 48b83f1 - extensionDownloader: Fix loading of downloaded extensions
Attachment 217577 [details] pushed as 67689f1 - browser-plugin: Prevent a copy when checking for valid extension UUIDs
Attachment 217578 [details] pushed as 6a117ac - browser-plugin: Rework scriptable method argument parsing and dispatch
Attachment 217579 [details] pushed as 8915bb4 - extensionDownloader: Fix errors during error paths during installation
Attachment 217580 [details] pushed as 1d1359b - extensionDownloader: Properly error out when downloading/parsing infos
Attachment 217581 [details] pushed as 7949397 - shellDBus: Add a real error reporting system to InstallExtensionRemote
Attachment 217583 [details] pushed as 23e86d7 - extensionDownloader: Clean up names of methods
Comment 32 Giovanni Campagna 2012-07-06 23:06:07 UTC
(In reply to comment #28)
> (In reply to comment #21)
> > Review of attachment 217584 [details] [review] [details]:
> > 
> > This is kind of the opposite of the previous error handling patch. Should
> > ExtensionFinder take an error callback instead? This way, it would logged in
> > the usual place for extension errors, and thus reported to e.g.o owners.
> 
> "Meh". We need a much better system for handling async errors. I'm really not
> the biggest fan of the errback/callback stuff I've already been doing.

a-c-n, then. It's not public API anyway, we can fix it if we don't like it.

(In reply to comment #29)
> (In reply to comment #24)
> > I'd say this belongs in Gio, yes. My primary concern anyway was to do atomic
> > renames whenever possible (that is, when /tmp and /home live on the same
> > partition)
> 
> Not going to happen.

Ok with the recursive JS fallback then.

(In reply to comment #30)
> (In reply to comment #24)
> > > That's not true at all. Try it.
> > 
> > Tried, and it works... Tried even valgrinding, no errors.
> 
> Hm. It does work, but this seems like it's exploiting an implementation detail
> in gjs itself -- it still breaks with PyGObject.

An implementation detail we control, since we're also gjs developers (and really, there is no other way to it).
Also, did you consider g_dir_make_tmp?
Comment 33 Jasper St. Pierre (not reading bugmail) 2012-07-07 01:33:18 UTC
Created attachment 218207 [details] [review]
extensionUtils: Don't crash on startup for an empty directory
Comment 34 Jasper St. Pierre (not reading bugmail) 2012-07-07 01:33:28 UTC
Created attachment 218208 [details] [review]
extensionDownloader: Move extension loading code to the install dialog

Move the part that loads the extension to the callback. This makes the
next patch a lot cleaner.
Comment 35 Jasper St. Pierre (not reading bugmail) 2012-07-07 01:33:54 UTC
Created attachment 218209 [details] [review]
extensionDownloader: Add update/blacklist support for extensions

This is a bare-bones copy/replace. It does not implement ChangeLog
support. If we cannot get System Updates integration, I will implement
notification support.



Thanks for the pointer to g_dir_make_tmp. We have a really schizophrenic platform.
Comment 36 Giovanni Campagna 2012-07-10 18:15:59 UTC
Review of attachment 218207 [details] [review]:

.
Comment 37 Giovanni Campagna 2012-07-10 18:16:32 UTC
Review of attachment 218208 [details] [review]:

Ok
Comment 38 Giovanni Campagna 2012-07-10 18:18:28 UTC
Review of attachment 218209 [details] [review]:

Ok
Comment 39 Jasper St. Pierre (not reading bugmail) 2012-07-10 18:37:07 UTC
Attachment 218207 [details] pushed as 1363d30 - extensionUtils: Don't crash on startup for an empty directory
Attachment 218208 [details] pushed as 539993b - extensionDownloader: Move extension loading code to the install dialog
Attachment 218209 [details] pushed as 1e286e4 - extensionDownloader: Add update/blacklist support for extensions