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 645542 - grl_metadata_source_set_metadata() broken
grl_metadata_source_set_metadata() broken
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: core
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2011-03-22 15:35 UTC by Lionel Landwerlin
Modified: 2011-03-30 17:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bring coherence to filter functions in GrlMetadatasource (7.57 KB, patch)
2011-03-29 08:12 UTC, Juan A. Suarez Romero
none Details | Review
Add proper documentation/behaviour in filter_foo() functions (8.42 KB, patch)
2011-03-30 11:57 UTC, Juan A. Suarez Romero
none Details | Review
Fix filter_key_list() (3.26 KB, patch)
2011-03-30 11:58 UTC, Juan A. Suarez Romero
none Details | Review

Description Lionel Landwerlin 2011-03-22 15:35:13 UTC
On the current git master, grl_metadata_source_set_metadata() does not seem to work. The problem seems to be in the grl_metadata_source_filter_writable function, which does not return either what the documentation states and what the calling function expects.
Comment 1 Juan A. Suarez Romero 2011-03-29 08:08:02 UTC
Yes, actually the grl_metadata_source_filter_foo() are a bit messy: some of them do one thing and others do exactly the opposite. And most of them do not honor what the documentation states.
Comment 2 Juan A. Suarez Romero 2011-03-29 08:12:22 UTC
Created attachment 184534 [details] [review]
Bring coherence to filter functions in GrlMetadatasource

This patch fixes this bug by bringing some coherence to filter functions.

Basically, makes grl_metadata_source_filter_supported/writable/slow() to filter a list of keys so only those suported/writable/slow are kept. If return_filtered is TRUE then the removed keys are returned in a list.
Comment 3 Iago Toral 2011-03-29 14:38:55 UTC
> Basically, makes grl_metadata_source_filter_supported/writable/slow() to filter
> a list of keys so only those suported/writable/slow are kept. If
> return_filtered is TRUE then the removed keys are returned in a list.

mmm... I see you changed the behaviour of filter_supported and filter_writable, right? and that filter_slow was kept as it was before, correct?

Then I see you adapted the caller of filter_writable to the changes you did, but I do not see any caller of filter_supported being changed by your patch so either I am missing something or you forgot that.

In any case, we had our fair share of bugs every time somebody decided to change the semantics of the filtering functions, so test this throughly with test-ui in all the three cases: slow keys, supported keys and writable keys to make sure we are not adding new regressions.
Comment 4 Juan A. Suarez Romero 2011-03-29 14:54:23 UTC
(In reply to comment #3)
> mmm... I see you changed the behaviour of filter_supported and filter_writable,
> right? and that filter_slow was kept as it was before, correct?


Yes. I used filter_slow() semantics because it seemed more logical to me.

> Then I see you adapted the caller of filter_writable to the changes you did,
> but I do not see any caller of filter_supported being changed by your patch so
> either I am missing something or you forgot that.

Yes, reason is that the function is not used in any place.

I think it is because Guillaume made a refactor some time ago to fix some problems with the full-resolution, and at the end he didn't use this filter_supported().

At this moment, plugins are not using this function neither.

We have two choices: removing the function, or keeping it if it can be useful for clients/plugins.

> In any case, we had our fair share of bugs every time somebody decided to
> change the semantics of the filtering functions, so test this throughly with
> test-ui in all the three cases: slow keys, supported keys and writable keys to
> make sure we are not adding new regressions.

Sure. The point of the change was precisely to bring a coherence in the semantics, because it wasn't very clear the purpose (it was harder for me to understand the real purpose of the functions).
Comment 5 Juan A. Suarez Romero 2011-03-30 11:57:40 UTC
Created attachment 184687 [details] [review]
Add proper documentation/behaviour in filter_foo() functions

This is a revamp of previous patch.

Checking what is the most common use cases for this filter_foo() functions, I've ended up changing a little bit the behaviour, so they are more natural to use.

grl_metadata_key_filter_supported() and filter_writable() are used to just only handle supported and writable keys. For this reason, these functions will keep in the list the supported and writable keys.

On the other hand, grl_metadata_key_filter_slow() is used to get rid of slow keys and just focus on the fastest ones. For this reason, this function does the opposite of previous ones: removes the slow keys from the list of keys.
Comment 6 Juan A. Suarez Romero 2011-03-30 11:58:26 UTC
Created attachment 184688 [details] [review]
Fix filter_key_list()

This patch is part of the fix for this bug.

It fixes filter_key_list(), as the function was doing wrong.
Comment 7 Juan A. Suarez Romero 2011-03-30 17:40:49 UTC
Fixed as:


commit 6c87a766536df0ac30597084c25cf4201fbecf7d
Author: Juan A. Suarez Romero <jasuarez@igalia.com>
Date:   Wed Mar 30 11:50:58 2011 +0000

    core: Fix filter_key_list() function
    
    This function was working bad.
    
    This fixes https://bugzilla.gnome.org/show_bug.cgi?id=645542
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>

 src/grl-metadata-source.c |   52 +++++++++++++++++---------------------------
 1 files changed, 20 insertions(+), 32 deletions(-)

commit 3b57b73d971ad7e2047afa9aa919d836c408b3fd
Author: Juan A. Suarez Romero <jasuarez@igalia.com>
Date:   Wed Mar 30 11:50:30 2011 +0000

    core: Fix filter_foo() functions
    
    Currently, grl_metadata_source_filter_{supported,writable,slow}() functions do
    not honor what the documentation states.
    
    In order to bring more coherence here, this patch makes
    grl_metadata_source_filter_{supported,writable}() to keep only the keys that
    are {supported,writable}, and returning the removed keys in a new list.
    
    In the case of grl_metadata_source_filter_slow(), it does the opposite: the
    list is filtered so only the fastest keys are kept; the slower ones are
    returned in a list. This is done in this way because it is the most common case
    of use for this function.
    
    This fixes https://bugzilla.gnome.org/show_bug.cgi?id=645542
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>

 src/grl-metadata-source.c |  107 ++++++++++++++++++---------------------------
 1 files changed, 43 insertions(+), 64 deletions(-)