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 775679 - arg: don't crash when asked to convert a null strv to an array
arg: don't crash when asked to convert a null strv to an array
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.47.x
Other Linux
: Normal major
: ---
Assigned To: Sam Spilsbury
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2016-12-06 00:54 UTC by Cosimo Cecchi
Modified: 2017-04-26 17:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
regress: Add test for setting a NULL strv in a GValue (4.26 KB, patch)
2017-03-03 00:43 UTC, Sam Spilsbury
none Details | Review
tests: Call Everything.test_null_strv_in_gvalue() (931 bytes, patch)
2017-03-03 00:44 UTC, Sam Spilsbury
none Details | Review
regress: Add test for setting a NULL strv in a GValue (6.79 KB, patch)
2017-04-05 01:31 UTC, Sam Spilsbury
committed Details | Review
tests: Call Everything.test_null_strv_in_gvalue (1014 bytes, patch)
2017-04-05 01:39 UTC, Sam Spilsbury
reviewed Details | Review
arg: Don't crash when asked to convert a null strv to a value (1.14 KB, patch)
2017-04-24 23:44 UTC, Sam Spilsbury
none Details | Review
arg: Don't crash when asked to convert a null strv to a value (1.87 KB, patch)
2017-04-24 23:50 UTC, Sam Spilsbury
committed Details | Review

Description Cosimo Cecchi 2016-12-06 00:54:43 UTC
We have a patch in Endless for this -- see https://github.com/endlessm/gjs/commit/4098edf99da8c3a6cb96126e2338db6f6f2ac205 and the comment in there for rationale.
Comment 1 Giovanni Campagna 2016-12-06 02:12:39 UTC
A NULL strv is not an empty array, it's null. An empty strv is a valid pointer to NULL.

What API triggers this?
Comment 2 Philip Chimento 2017-01-25 00:55:57 UTC
If I understand correctly, it's code generated by gdbus-codegen that triggers this, so it's unlikely to just be a misuse of the API.

Sam, do you have some time to create a minimal reproducer?
Comment 3 Sam Spilsbury 2017-03-03 00:43:28 UTC
Created attachment 347110 [details] [review]
regress: Add test for setting a NULL strv in a GValue

This uses the Everything.test_null_strv_in_gvalue() added to Regress in a later patch
Comment 4 Sam Spilsbury 2017-03-03 00:44:10 UTC
Created attachment 347112 [details] [review]
tests: Call Everything.test_null_strv_in_gvalue()

Call Everything.test_null_strv_in_gvalue() from regress
Comment 5 Sam Spilsbury 2017-03-03 00:44:55 UTC
(In reply to Sam Spilsbury from comment #3)
> Created attachment 347110 [details] [review] [review]
> regress: Add test for setting a NULL strv in a GValue
> 
> This uses the Everything.test_null_strv_in_gvalue() added to Regress in a
> later patch

Ugh, mixed these two up - This one is for gobject-introspection , the other is for gjs
Comment 6 Philip Chimento 2017-03-05 21:12:23 UTC
Review of attachment 347110 [details] [review]:

I think you forgot the actual test? These are just the generated documentation changes.
Comment 7 Philip Chimento 2017-03-05 21:14:05 UTC
Review of attachment 347112 [details] [review]:

This will need rebasing on master, since we've switched test frameworks. But it should be pretty trivial.
Comment 8 Sam Spilsbury 2017-04-05 01:29:31 UTC
(In reply to Philip Chimento from comment #6)
> Review of attachment 347110 [details] [review] [review]:
> 
> I think you forgot the actual test? These are just the generated
> documentation changes.


Oops, sorry I missed this! I'll re-attach those patches now
Comment 9 Sam Spilsbury 2017-04-05 01:31:31 UTC
Created attachment 349267 [details] [review]
regress: Add test for setting a NULL strv in a GValue

Adds additional missing files from commit
Comment 10 Sam Spilsbury 2017-04-05 01:39:14 UTC
Created attachment 349268 [details] [review]
tests: Call Everything.test_null_strv_in_gvalue

Rebased
Comment 11 Philip Chimento 2017-04-05 01:48:25 UTC
Review of attachment 349268 [details] [review]:

::: installed-tests/js/testEverythingBasic.js
@@ +588,3 @@
 
+    it('correctly converts a NULL strv in a GValue to an empty array', function() {
+        let v = Everything.test_null_strv_in_gvalue();

Renamed to "Regress"
Comment 12 Philip Chimento 2017-04-05 01:48:54 UTC
Review of attachment 349267 [details] [review]:

Seems fine to me, but I'm not a gobject-introspection reviewer. Cosimo, could you take a look please?
Comment 13 Cosimo Cecchi 2017-04-06 02:31:41 UTC
Review of attachment 349267 [details] [review]:

I'm not a gobject-introspection maintainer, but this one looks good to me as well.
Comment 14 Cosimo Cecchi 2017-04-06 02:32:35 UTC
Rico, could you review the gobject-introspection patch, please?
Comment 15 Philip Chimento 2017-04-24 22:29:25 UTC
Review of attachment 349268 [details] [review]:

Sam, I just realized that this patch lost the actual fix, somewhere along the line...
Comment 16 Sam Spilsbury 2017-04-24 23:44:07 UTC
Created attachment 350348 [details] [review]
arg: Don't crash when asked to convert a null strv to a value
Comment 17 Sam Spilsbury 2017-04-24 23:50:16 UTC
Created attachment 350349 [details] [review]
arg: Don't crash when asked to convert a null strv to a value
Comment 18 Philip Chimento 2017-04-24 23:52:55 UTC
Review of attachment 350349 [details] [review]:

+1. Would be accepted-commit-now, but we need the gobject-introspection patch to be merged.

Rico, would you be able to take a look at that?
Comment 19 Rico Tzschichholz 2017-04-25 12:15:40 UTC
Comment on attachment 349267 [details] [review]
regress: Add test for setting a NULL strv in a GValue

Attachment 349267 [details] pushed as f9d58df - regress: Add test for setting a NULL strv in a GValue
Comment 20 Philip Chimento 2017-04-25 18:43:05 UTC
Review of attachment 350349 [details] [review]:

Thanks, Rico!

I'll commit this later and bump the requirement to g-i 1.53.1 for the tests.