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 702238 - oFono backend crashes when adding modems
oFono backend crashes when adding modems
Status: RESOLVED OBSOLETE
Product: folks
Classification: Platform
Component: oFono backend
git master
Other Linux
: Normal major
: 0.12.x
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2013-06-14 10:46 UTC by Rodrigo Moya
Modified: 2018-09-21 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that uses dup_strv to workaround bug in vala compiler (1.02 KB, patch)
2013-06-14 10:46 UTC, Rodrigo Moya
none Details | Review
Previous patch with fixed commit message (1.02 KB, patch)
2013-06-14 10:58 UTC, Rodrigo Moya
none Details | Review
Add FIXME with reference to Vala bug (1.19 KB, patch)
2013-06-17 14:13 UTC, Rodrigo Moya
none Details | Review
Patch with a 1st attempt at sandboxed test (8.46 KB, patch)
2013-06-26 08:38 UTC, Rodrigo Moya
none Details | Review
Almost fully working test suite (12.96 KB, patch)
2013-06-27 12:05 UTC, Rodrigo Moya
none Details | Review
Fully working oFono test suite for the fix (10.69 KB, patch)
2013-06-28 10:57 UTC, Rodrigo Moya
needs-work Details | Review

Description Rodrigo Moya 2013-06-14 10:46:08 UTC
Created attachment 246791 [details] [review]
Patch that uses dup_strv to workaround bug in vala compiler

When the folks oFono backend gets notified about a new modem, it uses GVariant's get_strv to retrieve features, which results, due to a bug in the Vala compiler, in the generated C code freeing both the container array and its elements, which is wrong, as g_variant_get_strv uses (transfer container) for the returned value.

The fix for the vala compiler doesn't seem to be trivial, so while it's not fixed, a workaround is to use g_variant_dup_strv instead of get_strv so that the generated C code frees what it needs to free.
Comment 1 Rodrigo Moya 2013-06-14 10:58:00 UTC
Created attachment 246792 [details] [review]
Previous patch with fixed commit message
Comment 2 Travis Reitter 2013-06-14 15:34:34 UTC
Thanks for the patch! Is it possible to create a small test case that can reproduce this issue (such that the patch fixes the test)?
Comment 3 Philip Withnall 2013-06-15 07:53:48 UTC
Also, can you add a FIXME comment to the patch with a link to the Vala bug number, so we can revert the change once the Vala bug’s fixed please?
Comment 4 Rodrigo Moya 2013-06-17 14:13:15 UTC
Created attachment 247037 [details] [review]
Add FIXME with reference to Vala bug
Comment 5 Rodrigo Moya 2013-06-17 14:14:46 UTC
Ok, so just missing the test program. I guess you want a test that calls the method in the oFono backend, right? If so, I guess just a program that calls 'folks-inspect personas' with a 3G modem plugged would do, since that is how I was getting the crash. Is that enough?
Comment 6 Travis Reitter 2013-06-18 22:51:58 UTC
(In reply to comment #5)
> Ok, so just missing the test program. I guess you want a test that calls the
> method in the oFono backend, right? If so, I guess just a program that calls
> 'folks-inspect personas' with a 3G modem plugged would do, since that is how I
> was getting the crash. Is that enough?

Can you add a small wrapper that fakes the presence of a 3G modem in oFono so this can be effectively checked without needing the hardware?

And please make sure that any test is sufficiently sandboxed that it won't affect the host user's settings or state. Our tests already set up a private D-Bus session bus, etc., to provide isolation, but you'll want to be careful that you maintain this type of behavior for the oFono tests as well.
Comment 7 Rodrigo Moya 2013-06-26 08:38:13 UTC
Created attachment 247799 [details] [review]
Patch with a 1st attempt at sandboxed test

Since ofono uses the system bus, I'm not able to make the test script start ofonod on the fake system bus. I guess we can provide a config file for the fake system bus, but seems ofono daemon still needs root privileges.

Will do another try, but will appreciate more eyes looking at the patch
Comment 8 Philip Withnall 2013-06-26 12:04:51 UTC
(In reply to comment #7)
> Since ofono uses the system bus, I'm not able to make the test script start
> ofonod on the fake system bus. I guess we can provide a config file for the
> fake system bus, but seems ofono daemon still needs root privileges.

Hmm, you might have to mock the ofono daemon instead then, using python-dbusmock, or an approach similar to what folks’ libsocialweb tests do.
Comment 9 Rodrigo Moya 2013-06-27 12:05:26 UTC
Created attachment 247898 [details] [review]
Almost fully working test suite

Adding this patch for further review. Only thing not working is the starting of the fake system daemon, which I think is because of the config file, so working on that to hopefully make it fully work soon
Comment 10 Rodrigo Moya 2013-06-28 10:57:46 UTC
Created attachment 247965 [details] [review]
Fully working oFono test suite for the fix

There was no need to really use a fake system bus, just running a session one and setting DBUS_SYSTEM_BUS_ADDRESS env var is enough, so now the patch is fully working. Feel free to review
Comment 11 Philip Withnall 2013-07-03 12:02:38 UTC
Review of attachment 247965 [details] [review]:

Looking good. If possible, you should get rid of the Bash scripts and re-use Simon’s work on Vala-based D-Bus mocking from tests/lib/test-case.vala. It would probably be helpful if you poked him about it, since I believe he has ideas for it which he never got time to implement; and he’s a lot more familiar with that code than I am.

::: tests/ofono/Makefile.am
@@ +9,3 @@
+	-I$(top_srcdir)/folks \
+	-I$(top_srcdir)/tests/lib \
+	-I$(top_srcdir)/tests/lib/key-file \

key-file shouldn’t be necessary here.

::: tests/ofono/ofono-test.vala
@@ +120,3 @@
+                          try
+                            {
+					          backend.prepare.end (r);

Dodgy indentation.

@@ +124,3 @@
+                            }
+                          catch (GLib.Error e)
+						  {

Dodgy indentation.

::: tests/tools/with-system-bus-ofono.sh
@@ +42,3 @@
+cleanup
+
+exit $e

You shouldn’t need this file, or dbus-session.sh. You can use the private_bus_up() method (and friends) in tests/lib/test-case.vala to handle that all without resorting to Bash. You might need to modify test-case.vala to support a fake system bus though.
Comment 12 GNOME Infrastructure Team 2018-09-21 16:03:29 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/folks/issues/64.