GNOME Bugzilla – Bug 609866
gvfs-gdu-volume-monitor crashed with SIGSEGV in gdu_pool_get_presentables()
Last modified: 2010-02-15 16:46:19 UTC
Created attachment 153727 [details] [review] patch to fix the crash This bug is being forwarded up from Ubuntu Lucid in this bug: https://bugs.edge.launchpad.net/ubuntu/+source/gnome-disk-utility/+bug/521481 When gdu_pool_get_presentables is called with a NULL pointer, it causes a sigsegv. The attached patch fixes this.
Hm, this seems to only cure a symptom, not the actual cause? In the interest of robustness and debugging I agree that it'd be nice to add a g_return_val_if_fail(pool != NULL, NULL) to the function (which is better than just silently returning), but I think it's an error to call the function with NULL in the first place, since that just hides logic errors.
Right, the patch doesn't really fix anything - it just masks the problem. The only way we can get into this situation (GduPool object construction failing) is if the app can't talk to the udisks service. Since the udisks service is activated on demand, it means this can only fail if a) udisks fails to start; and/or b) dbus activation is buggy. It turned out that dbus activation was more or less buggy, see recent D-Bus commits which should fix these issues Additionally, we now complain on stderr, see e.g. http://git.gnome.org/browse/gnome-disk-utility/tree/src/gdu/gdu-pool.c?id=aa729095f188ad8dbe036af375e1da6f32590470#n1942 if we for some reason can't construct a GduPool object. I still think the right answer is to crash if people try to use the return value from gdu_pool_new() and it's NULL... this is so we get the bug report (triggered by e.g. abrt) when this happens. In fact, it is partly because of these bug reports that we finally fixed the D-Bus activation bugs.
David, I'd still like to add some g_return_val_if_fail() bits to make this easier to debug in the future, is that okay with you?
(In reply to comment #3) > David, > > I'd still like to add some g_return_val_if_fail() bits to make this easier to > debug in the future, is that okay with you? Yup, sounds good. Thanks.
Sorry, of course I mean g_assert(), since we do want to crash the program (in order to not paper over the problem).
Assertions committed: http://git.gnome.org/browse/gnome-disk-utility/commit/?id=7e51727079e021d32ebe600bf3b6f8613c7d0cdf