SmartScopesClient - a missing attribute disables all remote scopes

Bug #1287873 reported by Paweł Stołowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unity-scopes-api
Fix Released
Critical
Marcus Tomlinson
unity-scopes-api (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The main loop in SmartScopesClient::get_remote_scopes() that parses remote-scopes result stops processing if a child node of a scope is missing one of the required attributes (or parsing fails for whatever reason). This effectively disables all scopes that hasn't been processed yet.

There are three problems that I see there:

- this "break" statement breaks main loop:

 if (!child_node->has_node("id") || !child_node->has_node("name") ||
                !child_node->has_node("description") || !child_node->has_node("author") ||
                !child_node->has_node("base_url"))
            {
                break;
            }

- no error/warning if a mandatory attribute is missing.

- the try..catch blocks surrounds entire loop (we should be handling exceptions inside the loop so that we can process as many remote scopes as possible).

Related branches

Revision history for this message
Michi Henning (michihenning) wrote :

Thanks for that Pawel!

Revision history for this message
Michi Henning (michihenning) wrote :

Could was also please add a test for this? We should test for presence and absence of both mandatory and optional attributes and check that subsequent scopes are still processed correctly.

We should also have tests for any non-trivial attributes, such as URLs. If they don't parse correctly, for example, we need to make sure that we don't abort processing of subsequent entries just because something is wrong with one attribute for one scope.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:unity-scopes-api/devel at revision 253, scheduled for release in unity-scopes-api, milestone Unknown

Changed in unity-scopes-api:
status: Confirmed → Fix Committed
Michal Hruby (mhr3)
Changed in unity-scopes-api (Ubuntu):
status: New → Fix Released
Changed in unity-scopes-api:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.