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 669211 - Don't call optional vfuncs when they don't exists
Don't call optional vfuncs when they don't exists
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: daemon
git master
Other Linux
: High major
: ---
Assigned To: gvfs-maint
gvfs-maint
: 655147 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-02-01 23:52 UTC by Giovanni Campagna
Modified: 2012-02-07 14:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GVfsJobUnmount: check that vfunc is implemented before calling it (1.08 KB, patch)
2012-02-01 23:52 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-02-01 23:52:34 UTC
From a shallow reading of the gvfs code, GVfsBackend::try_* vfuncs are optional, and in fact many backend don't implement all of them. On the other hand, GVfsJobUnmount->try calls try_unmount unconditionally if either try_unmount or unmount is implemented, and no processes are blocking unmount.
Practically speaking, this results in gvfsd-archive and gvfsd-ftp crashing. Probably other backends are affected too, since "git grep -e '->try_unmount'" only shows sftp implementing it.

Fast patch that I think fixes this coming.

(This is downstream bug https://bugzilla.redhat.com/show_bug.cgi?id=744564 )
Comment 1 Giovanni Campagna 2012-02-01 23:52:57 UTC
Created attachment 206601 [details] [review]
GVfsJobUnmount: check that vfunc is implemented before calling it

GVfsBackend::try_unmount is optional (like all the other try_* vfuncs),
and in fact many backends don't implement it.
In case it's NULL, returing FALSE does the right thing and schedules
a thread for calling ->unmount.
Comment 2 Christian Kirbach 2012-02-03 23:08:14 UTC
Thank you for the patch.
Comment 3 Tomas Bzatek 2012-02-07 14:27:34 UTC
Oh, nice shot, thanks for spotting this. I've added one more check in run() though it seems it's not needed.


commit e523572e14a9042696e1c5ccd4f30cb3240fa0df
Author: Giovanni Campagna <gcampagna@src.gnome.org>
Date:   Tue Feb 7 15:25:05 2012 +0100

    GVfsJobUnmount: check that vfunc is implemented before calling it
    
    GVfsBackend::try_unmount is optional (like all the other try_* vfuncs),
    and in fact many backends don't implement it.
    In case it's NULL, returing FALSE does the right thing and schedules
    a thread for calling ->unmount.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669211
Comment 4 Tomas Bzatek 2012-02-07 14:29:21 UTC
*** Bug 655147 has been marked as a duplicate of this bug. ***