Merge lp://staging/~xavi-garcia-mena/mediascanner2/ms-dbus-wal into lp://staging/mediascanner2

Proposed by Xavi Garcia
Status: Needs review
Proposed branch: lp://staging/~xavi-garcia-mena/mediascanner2/ms-dbus-wal
Merge into: lp://staging/mediascanner2
Diff against target: 2214 lines (+945/-453)
18 files modified
debian/control (+1/-0)
src/daemon/CMakeLists.txt (+1/-0)
src/mediascanner/CMakeLists.txt (+20/-2)
src/mediascanner/MediaStore.cc (+94/-19)
src/mediascanner/MediaStore.hh (+9/-1)
src/mediascanner/d-bus/service-stub.cc (+6/-0)
src/mediascanner/d-bus/service-stub.hh (+1/-0)
src/mediascanner/mediascanner-2.0.map (+35/-5)
src/ms-dbus/CMakeLists.txt (+1/-2)
src/ms-dbus/main.cc (+2/-2)
src/ms-dbus/service-skeleton.cc (+2/-2)
src/ms-dbus/service-skeleton.hh (+1/-1)
src/qml/Ubuntu/MediaScanner/MediaStoreWrapper.cc (+1/-1)
test/CMakeLists.txt (+15/-5)
test/test_dbus.cc (+1/-1)
test/test_mediastore.cc (+658/-412)
test/utils/DBusTest.cpp (+50/-0)
test/utils/DBusTest.h (+47/-0)
To merge this branch: bzr merge lp://staging/~xavi-garcia-mena/mediascanner2/ms-dbus-wal
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Jussi Pakkanen (community) Needs Fixing
Jamie Strandboge Pending
James Henstridge Pending
Review via email: mp+249346@code.staging.launchpad.net

Commit message

Modified to use the d-bus interface when MediaStore is created in Read Only mode.

Description of the change

Modified to use the d-bus interface when MediaStore is created in Read Only mode.

To post a comment you must log in.
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looking quite nice. However one thing that is a bit concerning is that the tests duplicate a lot of code in the dbus and non-dbus cases. Would it be possible to consolidate these so that every test is run with common code. So something along the lines of this:

void testImplementation(MediaStore &writer, MediaStore &queryer) {
  // First set up
  writer.insert(whatevs);

  // Then query
  ASSERT_EQ(queryer.query("..."), result);
}

And then have the actual dbus and non-dbus test cases just do basically this:

void testWithoutDbus() {
  MediaStore local(READWRITE);

  testImplementation(local, local);
}

void testWithDbus() {
  MediaStore writer(READWRITE);
  MediaStore queryer(READONLY);

  testImplementation(writer, queryer);
}

review: Needs Fixing
300. By Xavi Garcia

Modifed media store tests to avoid duplicating code

301. By Xavi Garcia

Removed Unity-api dependency, as it was not needed

302. By Xavi Garcia

Added libqtdbustest to test the d-bus connection

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looks fine. Just a few niggles:

- the new variables have an underscore after their names, whereas the naming convention elsewere is not to have underscores
- when printing the text about error messages, please also print the URL of the bug in question
- in brokenfiles you wrap everything in a try/catch that just prints a generic error, why is this, AFAICR gtest will automatically fail any test that throws and prints the exception's error messag

I think we need to start talking to Jamie about the dbus/apparmor bits that this thing needs (also in music-app).

review: Needs Fixing
303. By Xavi Garcia

Erased final _ for member variables

Revision history for this message
Xavi Garcia (xavi-garcia-mena) wrote :

Hey Jussi,

what file do you mean when you say?
*when printing the text about error messages, please also print the URL of
the bug in question*

What do you mean to print the URL of the bug? When an exception is thrown?

I've erased the try... catch, as it was part of a test I did and changed
(but obviously forgot to erase the try..catch)

Thanks,

Xavi

On Mon, Feb 16, 2015 at 2:40 PM, Jussi Pakkanen <
<email address hidden>> wrote:

> Review: Needs Fixing
>
> Looks fine. Just a few niggles:
>
> - the new variables have an underscore after their names, whereas the
> naming convention elsewere is not to have underscores
> - when printing the text about error messages, please also print the URL
> of the bug in question
> - in brokenfiles you wrap everything in a try/catch that just prints a
> generic error, why is this, AFAICR gtest will automatically fail any test
> that throws and prints the exception's error messag
>
> I think we need to start talking to Jamie about the dbus/apparmor bits
> that this thing needs (also in music-app).
> --
>
> https://code.launchpad.net/~xavi-garcia-mena/mediascanner2/ms-dbus-wal/+merge/249346
> You are the owner of lp:~xavi-garcia-mena/mediascanner2/ms-dbus-wal.
>

304. By Xavi Garcia

Added bug link in error message and remove unnecessary try...catch in unit test

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Now we need to do the AppArmor bits and for that we need Jamie's help, so I subscribed him.

What we are trying to do here is the following:

Currently users of Mediascanner (media scopes and music-app) have read-only access to Mediascanner's media storage dir ~/.cache/mediascanner-2.0. This MR changes it so that they no longer may access the file directly, instead they call a small dbus server binary instead.

This means that we need the following Apparmor changes:

- remove read access from existing users
- grant them access to the dbus server instead
- create new daemon that is allowed to own the service name and has r/w access to the media directory

Does this seem like a suitable approach, security-wise?

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

FAILED: Continuous integration, rev:304
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~xavi-garcia-mena/mediascanner2/ms-dbus-wal/+merge/249346/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner2-ci/188/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner2-vivid-amd64-ci/25/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner2-vivid-armhf-ci/25/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mediascanner2-vivid-i386-ci/25/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner2-ci/188/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

304. By Xavi Garcia

Added bug link in error message and remove unnecessary try...catch in unit test

303. By Xavi Garcia

Erased final _ for member variables

302. By Xavi Garcia

Added libqtdbustest to test the d-bus connection

301. By Xavi Garcia

Removed Unity-api dependency, as it was not needed

300. By Xavi Garcia

Modifed media store tests to avoid duplicating code

299. By Xavi Garcia

Using DBus for read only mode

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: