Gjs promises on Gio.File operations don't work anymore after upgrading libglib2.0-0 2.67.5-2 to 2.68.0-1 (and indicator-multiload app broke)

Bug #1923267 reported by fprietog
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gjs (Ubuntu)
Fix Released
High
Marco Trevisan (Treviño)
Hirsute
Won't Fix
High
Marco Trevisan (Treviño)
gnome-shell-extension-appindicator (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

[ Impact ]

As per glib commit https://gitlab.gnome.org/GNOME/glib/-/commit/d52728f99 Gio.File.new_for_path("") returns a GDummyFile implementation, while Gio._promisify relies on it being a LocalFile, so we don't promisify the right methods.

[ Test case ]

gjs -c "imports.gi.Gio._promisify(imports.gi.Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
   print(imports.gi.Gio.File.new_for_path('/').delete_async(0, null));" && echo GJS works

Should write on terminal:

[object Promise]
GJS works

In the bugged version would instead just:

(gjs:226393): Gjs-CRITICAL **: 16:45:51.396: JS ERROR: TypeError: method Gio.File.delete_async: At least 3 arguments required, but only 2 passed
@<command line>:2:48

(gjs:226393): Gjs-CRITICAL **: 16:45:51.396: Script <command line> threw an exception

[ Regression potential ]

Gjs apps are slower in starting up, or not act properly when / is not a local location.

---

Problem tested in two different environments:
- Ubuntu 21.04 Beta amd64
- Ubuntu 21.04 Beta arm64 (Raspberry Pi 4B 8GB)

After upgrading these packages:

libglib2.0-0 2.67.5-2 to 2.68.0-1
libglib2.0-bin 2.67.5-2 to 2.68.0-1
libglib2.0-data 2.67.5-2 to 2.68.0-1

The app indicator-multiload (0.4-0ubuntu5) doesn't work showing only three dots (...) instead of the graphic expected. It's throwing error messages to the system journal every second or so (depends of the refresh interval selected in the app settings):

abr 10 01:08:06 fpgrpi <email address hidden>[1487]: multiload, Impossible to read image from path '/run/user/1026/multiload-icons-Wc8kck/icons/indicator-multiload-graphs-0.png': TypeError: method Gio.File.read_async: At least 3 arguments required, but only 2 passed

Don't know if this is a documented change of that method and the bug should be open for the indicator-multiload app. Please, if that's the case just let me know to do it.

Thanks and best reagrds

Revision history for this message
Sebastien Bacher (seb128) wrote :

The errors seems to be coming from gnome-shell-extension-appindicator there, do you still get the issue using https://launchpad.net/ubuntu/+source/gnome-shell-extension-appindicator/35-1 ?

affects: glib2.0 (Ubuntu) → gnome-shell-extension-appindicator (Ubuntu)
Revision history for this message
fprietog (fprietog) wrote :

Unfortunately I still got the same problem with gnome-shell-extension-appindicator 35-1 installed.

I don't think that this will be related to gnome-shell-extension-appindicator because I'm also getting this error message every boot and it that seems to be the same problem in a different app and not related to indicators:

abr 21 19:25:19 fprietog-VirtualBox gnome-shell[1361]: JS ERROR: TypeError: method Gio.File.delete_async: At least 3 arguments required, but only 2 passed
_handleLockScreenWarning@resource:///org/gnome/shell/ui/main.js:323:24
_initializeUI/<@resource:///org/gnome/shell/ui/main.js:303:13
_startupAnimationComplete@resource:///org/gnome/shell/ui/layout.js:733:14
onComplete@resource:///org/gnome/shell/ui/layout.js:711:36
_makeEaseCallback/<@resource:///org/gnome/shell/ui/environment.js:85:13
_easeActor/<@resource:///org/gnome/shell/ui/environment.js:168:64

I can assure that with libglib2.0-0, libglib2.0-bin and libglib2.0-data version 2.67.5-2 it works, but with version to 2.68.0-1 it doesn't.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

The problem is in gjs, and is fixed by https://gitlab.gnome.org/GNOME/gjs/-/commit/ec9385b89cb2bce0615093c3c957cbbb5ea6b769

Can be in fact be something a bit more problematic here, as any extension using Gio.File promises won't work.

The shell will be affected in a limited way.

Changed in gnome-shell-extension-appindicator (Ubuntu):
status: New → Won't Fix
Changed in gjs (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
importance: Medium → High
summary: - indicator-multiload app broken after upgrading libglib2.0-0 2.67.5-2 to
- 2.68.0-1
+ Gjs promises on Gio.File operations don't work anymore after upgrading
+ libglib2.0-0 2.67.5-2 to 2.68.0-1 (and indicator-multiload app broke)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello fprietog, or anyone else affected,

Accepted gjs into hirsute-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gjs/1.67.2-2ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-hirsute to verification-done-hirsute. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-hirsute. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gjs (Ubuntu Hirsute):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-hirsute
Revision history for this message
fprietog (fprietog) wrote :

Hello Brian,

Just tested arm64 build; updated these packages:

- gjs_1.67.2-2ubuntu2_arm64.deb

fprietog@fpgrpi:~$ apt-cache policy gjs
gjs:
  Instalados: 1.67.2-2ubuntu2
  Candidato: 1.67.2-2ubuntu2
  Tabla de versión:
 *** 1.67.2-2ubuntu2 100
        100 /var/lib/dpkg/status
     1.67.2-2ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports hirsute/main arm64 Packages

- libgjs0g_1.67.2-2ubuntu2_arm64.deb

fprietog@fpgrpi:~$ apt-cache policy libgjs0g
libgjs0g:
  Instalados: 1.67.2-2ubuntu2
  Candidato: 1.67.2-2ubuntu2
  Tabla de versión:
 *** 1.67.2-2ubuntu2 100
        100 /var/lib/dpkg/status
     1.67.2-2ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports hirsute/main arm64 Packages

And, after reboot, the problem reported is solved:

1./ Test case:
fprietog@fpgrpi:~$ gjs -c "imports.gi.Gio._promisify(imports.gi.Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
   print(imports.gi.Gio.File.new_for_path('/').delete_async(0, null));" && echo GJS works
[object Promise]
GJS works

2./ The error shown in every boot as also gone.

3./ The indicator-multiload app now is working as expected

I'll test amd64 build when available.

Revision history for this message
fprietog (fprietog) wrote :

Just tested amd64 packages with the same results than arm64: problem is solved.

Thanks and best regards.

Revision history for this message
fprietog (fprietog) wrote :
Download full text (3.6 KiB)

BTW: as I said the problem is solved with the proposed builds.

So, the indicator-multiload app is working as expected. But I just realized that is throwing another messages at its start, messages that it's not throwing in Ubuntu 20.10 groovy. These are the messages:

amd64:
------
abr 23 02:54:52 fprietog-VirtualBox gnome-shell[1339]: value "nan" of type 'gfloat' is invalid or out of range for property 'x' of type 'gfloat'
abr 23 02:54:52 fprietog-VirtualBox gnome-shell[1339]: value "nan" of type 'gfloat' is invalid or out of range for property 'y' of type 'gfloat'
abr 23 02:54:52 fprietog-VirtualBox gnome-shell[1339]: JS ERROR: Exception in callback for signal: shown: Error: Wrong type number; float expected. But it's out of range: -Infinity
_init/GObject.Object.prototype.set@resource:///org/gnome/gjs/modules/core/overrides/GObject.js:553:16
_easeActor@resource:///org/gnome/shell/ui/environment.js:155:15
init/Clutter.Actor.prototype.ease@resource:///org/gnome/shell/ui/environment.js:294:19
_syncWorkspacesActualGeometry@resource:///org/gnome/shell/ui/workspacesView.js:728:21
_init/this._overviewShownId<@resource:///org/gnome/shell/ui/workspacesView.js:396:18
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_showDone@resource:///org/gnome/shell/ui/overview.js:604:14
onComplete@resource:///org/gnome/shell/ui/overview.js:589:36
_makeEaseCallback/<@resource:///org/gnome/shell/ui/environment.js:85:13
_easeActor/<@resource:///org/gnome/shell/ui/environment.js:168:64

arm64:
------
abr 23 00:18:31 fpgrpi gnome-shell[1494]: value "nan" of type 'gfloat' is invalid or out of range for property 'x' of type 'gfloat'
abr 23 00:18:31 fpgrpi gnome-shell[1494]: value "nan" of type 'gfloat' is invalid or out of range for property 'y' of type 'gfloat'
abr 23 00:18:31 fpgrpi gnome-shell[1494]: JS ERROR: Exception in callback for signal: shown: Error: Wrong type number; float expected. But it's out of range: -Infinity
_init/GObject.Object.prototype.set@resource:///org/gnome/gjs/modules/core/overrides/GObject.js:553:16
_easeActor@resource:///org/gnome/shell/ui/environment.js:155:15
init/Clutter.Actor.prototype.ease@resource:///org/gnome/shell/ui/environment.js:294:19
_syncWorkspacesActualGeometry@resource:///org/gnome/shell/ui/workspacesView.js:728:21
_init/this._overviewShownId<@resource:///org/gnome/shell/ui/workspacesView.js:396:18
_emit@resource:///org/gnome/gjs/modules/core/_signals.js:114:47
_showDone@resource:///org/gnome/shell/ui/overview.js:604:14
onComplete@resource:///org/gnome/shell/ui/overview.js:589:36
_makeEaseCallback/<@resource:///org/gnome/shell/ui/environment.js:85:13
_easeActor/<@resource:///org/gnome/shell/ui/environment.js:168:64
abr 23 00:18:31 fpgrpi gnome-shell[1494]: value "nan" of type 'gfloat' is invalid or out of range for property 'x' of type 'gfloat'
abr 23 00:18:31 fpgrpi gnome-shell[1494]: value "nan" of type 'gfloat' is invalid or out of range for property 'y' of type 'gfloat'
abr 23 00:18:31 fpgrpi gnome-shell[1494]: JS ERROR: Error: Wrong type number; float expected. But it's out of range: -Infinity
_init/GObject.Object.prototype.set@resource:///org/gnome/gjs/modules/core/overrides/GObject.js:553:16
_easeActor...

Read more...

Revision history for this message
fprietog (fprietog) wrote :

Forget about the messages that I show in the previous post: it seems that this problem is also happening in Ubuntu 20.10 groovy and are unrelated to the original bug. I didn't realize these messages before because in groovy these messages are way less informative than in hirsute. In groovy it only show:

abr 23 02:45:40 fpglinux gnome-shell[1730]: value "nan" of type 'gfloat' is invalid or out of range for property 'x' of type 'gfloat'
abr 23 02:45:40 fpglinux gnome-shell[1730]: value "nan" of type 'gfloat' is invalid or out of range for property 'y' of type 'gfloat'
abr 23 02:45:40 fpglinux gnome-shell[1730]: value "-inf" of type 'gfloat' is invalid or out of range for property 'width' of type 'gfloat'
abr 23 02:45:40 fpglinux gnome-shell[1730]: value "-inf" of type 'gfloat' is invalid or out of range for property 'height' of type 'gfloat'

So it's probably happening since ages...

Thank you very much for the quick fix and happy releasing.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gjs - 1.67.2-2ubuntu2

---------------
gjs (1.67.2-2ubuntu2) hirsute; urgency=medium

  * debian/{control,gbp.conf}: Use ubuntu specifics
  * debian/patches: Ensure Gio will use valid LocalFilePrototype (LP: #1923267)

 -- Marco Trevisan (Treviño) <email address hidden> Thu, 22 Apr 2021 01:34:40 +0200

Changed in gjs (Ubuntu):
status: Fix Committed → Fix Released
tags: added: verification-done verification-done-hirsute
removed: verification-needed verification-needed-hirsute
Revision history for this message
fprietog (fprietog) wrote :

Finally will the fix be released for Hirsute? Seems that it has been moved form Hirsute (Proposed) to Impish.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

The package is waiting in the SRU queue https://launchpad.net/ubuntu/hirsute/+queue?queue_state=1&queue_text=gjs you may ask in #ubuntu-release to speed it up :)

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Hello fprietog, or anyone else affected,

Accepted gjs into hirsute-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gjs/1.68.1-1~ubuntu0.21.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-hirsute to verification-done-hirsute. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-hirsute. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

tags: added: verification-needed verification-needed-hirsute
removed: verification-done verification-done-hirsute
Revision history for this message
fprietog (fprietog) wrote :

Proposed fix tested in hirsute on a Raspberry Pi4 arm64 and on an PC amd64.

Packages installed from hirsute-proposed:

libgjs0g (1.68.1-1~ubuntu0.21.04.1)
gjs (1.68.1-1~ubuntu0.21.04.1)

And, after reboot, do those tests:

1./ Test case:
gjs -c "imports.gi.Gio._promisify(imports.gi.Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
   print(imports.gi.Gio.File.new_for_path('/').delete_async(0, null));" && echo GJS works
[object Promise]
GJS works

2./ The error shown in every boot is gone.

3./ The indicator-multiload app is working as expected

So the bug seem to be fixed. Thanks and best regards.

tags: added: verification-done-hirsute
removed: verification-needed-hirsute
Revision history for this message
Brian Murray (brian-murray) wrote :

The Hirsute Hippo has reached End of Life, so this bug will not be fixed for that release.

Changed in gjs (Ubuntu Hirsute):
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.